結果

問題 No.487 2017 Calculation(2017の計算)
ユーザー kohei2019kohei2019
提出日時 2022-01-30 12:51:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 297 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 71,536 KB
最終ジャッジ日時 2023-09-02 01:31:47
合計ジャッジ時間 2,465 ms
ジャッジサーバーID
(参考情報)
judge13 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,232 KB
testcase_01 AC 65 ms
71,536 KB
testcase_02 AC 63 ms
71,220 KB
testcase_03 AC 64 ms
71,424 KB
testcase_04 AC 68 ms
71,316 KB
testcase_05 AC 64 ms
71,244 KB
testcase_06 AC 65 ms
71,368 KB
testcase_07 AC 66 ms
71,108 KB
testcase_08 AC 66 ms
71,524 KB
testcase_09 AC 64 ms
71,424 KB
testcase_10 AC 65 ms
71,228 KB
testcase_11 AC 66 ms
71,360 KB
testcase_12 AC 65 ms
71,360 KB
testcase_13 AC 65 ms
71,308 KB
testcase_14 AC 66 ms
71,200 KB
testcase_15 AC 64 ms
71,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M = int(input())
def modPow(a,n,mod):#繰り返し二乗法 a**n % mod
    if n==0:
        return 1
    if n==1:
        return a%mod
    if n & 1:
        return (a*modPow(a,n-1,mod)) % mod
    t = modPow(a,n>>1,mod)
    return (t*t)%mod

a = modPow(2017*2017,2017,M)
ans = (a+2017)%M
print(ans)
0