結果
| 問題 | No.2393 Bit Grid Connected Component |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-29 07:54:06 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
AC
|
| 実行時間 | 233 ms / 2,000 ms |
| コード長 | 527 bytes |
| 記録 | |
| コンパイル時間 | 500 ms |
| コンパイル使用メモリ | 5,376 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-07 11:13:29 |
| 合計ジャッジ時間 | 1,995 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 20 |
ソースコード
local ffi = require("ffi")
local C = ffi.C
ffi.cdef[[
long long atoll(const char*);
]]
local function lltonumber(str)
return C.atoll(str)
end
local q = io.read("*n", "*l")
for iq = 1, q do
local x, y = io.read():match("(%d+) (%d+)")
x = lltonumber(x)
y = tonumber(y)
local c = y
for i = 1, y do
x = x / 2LL
end
while x % 2LL == 1LL do
c = c + 1
x = x / 2LL
end
local ans = 1LL
for i = 1, c do
ans = ans + ans
end
ans = ans - 1LL
ans = tostring(ans):gsub("LL", "")
print(ans)
end