結果

問題 No.16 累乗の加算
ユーザー 826814741_6826814741_6
提出日時 2018-12-26 16:40:31
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 297 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 6,952 KB
最終ジャッジ日時 2024-04-09 02:54:55
合計ジャッジ時間 750 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,820 KB
testcase_01 AC 1 ms
6,948 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

print((function (f, fh, m)
	local x,n,r = fh:read("*n"),fh:read("*n"),0
	for _=1,n do r=r+f(x,fh:read("*n"),m)%m end
	return r%m
end)(function (x, n, m)
	local ba,rs,r = bit.band,bit.rshift,1
	while n~=0 do r,x,n=ba(n,1)~=0 and r*(x%m) or r,x*(x%m),rs(n,1) end
	return r%m
end, io.stdin, 1000003))
0