結果
問題 | 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.Cffi.cdef[[long long atoll(const char*);]]local function lltonumber(str)return C.atoll(str)endlocal q = io.read("*n", "*l")for iq = 1, q dolocal x, y = io.read():match("(%d+) (%d+)")x = lltonumber(x)y = tonumber(y)local c = yfor i = 1, y dox = x / 2LLendwhile x % 2LL == 1LL doc = c + 1x = x / 2LLendlocal ans = 1LLfor i = 1, c doans = ans + ansendans = ans - 1LLans = tostring(ans):gsub("LL", "")print(ans)end