結果
問題 |
No.1184 Hà Nội
|
ユーザー |
👑 |
提出日時 | 2020-09-19 20:08:40 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 847 bytes |
コンパイル時間 | 43 ms |
コンパイル使用メモリ | 5,376 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 18:15:52 |
合計ジャッジ時間 | 873 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
local mod = 998244353 local mfl = math.floor local function bmul(x, y) local x0, y0 = x % 31596, y % 31596 local x1, y1 = mfl(x / 31596), mfl(y / 31596) return (x1 * y1 * 62863 + (x1 * y0 + x0 * y1) * 31596 + x0 * y0) % mod end local function badd(x, y) return (x + y) % mod end local function bsub(x, y) return x < y and x - y + mod or x - y end local function modpow(src, pow) local res = 1 while 0LL < pow do if pow % 2LL == 1LL then res = bmul(res, src) pow = pow - 1LL end src = bmul(src, src) pow = pow / 2LL end return res end local ffi = require("ffi") local C = ffi.C ffi.cdef[[ long long atoll(const char*); ]] s = io.read() a, b = s:match("(%d+) (%d+)") a = C.atoll(a) b = C.atoll(b) if a % b == 0LL then a = a / b else a = a / b + 1LL end z = modpow(2, a) z = bsub(z, 1) print(z)