結果
問題 |
No.2007 Arbitrary Mod (Easy)
|
ユーザー |
👑 |
提出日時 | 2022-07-17 15:16:03 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 425 bytes |
コンパイル時間 | 497 ms |
コンパイル使用メモリ | 7,076 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 16:26:34 |
合計ジャッジ時間 | 3,073 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
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 mod = 1000000007LL a, n = io.read():match("(%d+) (%d+)") a = lltonumber(a) n = lltonumber(n) local v = 1LL while 0LL < n do if n % 2LL == 1LL then v = (v * a) % mod end a = (a * a) % mod n = n / 2LL end print(1000000007) v = tostring(v):gsub("LL", "") print(v)