結果
問題 | No.492 IOI数列 |
ユーザー |
👑 |
提出日時 | 2020-04-22 12:58:49 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
WA
|
実行時間 | - |
コード長 | 984 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 6,820 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-11 04:47:55 |
合計ジャッジ時間 | 995 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 1 |
ソースコード
local mod = 1000000007local mfl = math.floorlocal function bmul(x, y)local x1, y1 = mfl(x / 31623), mfl(y / 31623)local x0, y0 = x - x1 * 31623, y - y1 * 31623return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % modendlocal function modpow(src, pow)local res = 1while 0LL < pow doif pow % 2LL == 1LL thenres = bmul(res, src)pow = pow - 1LLendsrc = bmul(src, src)pow = pow / 2LLendreturn resendlocal function modinv(src)return modpow(src, mod - 2LL)endlocal function lltonumber(str)local ret = 0LLfor i = 1, #str doret = ret * 10LL + str:sub(i, i):byte() - 48endreturn retendlocal n = lltonumber(io.read())local function solve2()local z = n % 11LLz = tostring(z):gsub("LL", "")z = tonumber(z)for i = 2, z doio.write("10")endio.write("1\n")endlocal function solve1()local r = modpow(100, n)r = bmul(modinv(99), r - 1)print(r)endsolve1()solve2()