結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー kou_kkkkou_kkk
提出日時 2023-10-20 12:40:22
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 269 bytes
コンパイル時間 5,892 ms
コンパイル使用メモリ 60,560 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-20 12:40:34
合計ジャッジ時間 11,527 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,372 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,372 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,372 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,372 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,372 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 1 ms
4,372 KB
testcase_29 AC 2 ms
4,372 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math, strscans

const m = 10 ^ 7
echo m

let (_, a, n) = stdin.readAll.scanTuple"$i $i"

proc powMod(a, n, x: int): int =
  if n == 1:
    x
  elif n mod 2 == 1:
    powMod(a, n.pred, x * a mod m)
  else:
    powMod(a, n div 2, x ^ 2 mod m)

echo powMod(a, n, a)
0