結果

問題 No.251 大きな桁の復習問題(1)
ユーザー Chihaya_chanChihaya_chan
提出日時 2020-08-11 23:34:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 5,000 ms
コード長 405 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 82,436 KB
実行使用メモリ 67,968 KB
最終ジャッジ日時 2024-04-17 17:49:53
合計ジャッジ時間 2,441 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
51,712 KB
testcase_01 AC 32 ms
51,968 KB
testcase_02 AC 32 ms
51,820 KB
testcase_03 AC 30 ms
51,712 KB
testcase_04 AC 29 ms
52,096 KB
testcase_05 AC 29 ms
51,328 KB
testcase_06 AC 31 ms
51,968 KB
testcase_07 AC 28 ms
51,584 KB
testcase_08 AC 28 ms
52,480 KB
testcase_09 AC 110 ms
67,968 KB
testcase_10 AC 113 ms
67,456 KB
testcase_11 AC 113 ms
67,456 KB
testcase_12 AC 110 ms
67,328 KB
testcase_13 AC 108 ms
67,456 KB
testcase_14 AC 110 ms
67,968 KB
testcase_15 AC 108 ms
67,328 KB
testcase_16 AC 108 ms
67,456 KB
testcase_17 AC 110 ms
67,456 KB
testcase_18 AC 109 ms
67,712 KB
testcase_19 AC 108 ms
67,200 KB
testcase_20 AC 31 ms
51,840 KB
testcase_21 AC 30 ms
51,328 KB
testcase_22 AC 31 ms
51,456 KB
testcase_23 AC 31 ms
51,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# problem 1
P = 129402307
N = input()
M = input()
N = N[::-1]
mod_N = 0
for i in range(len(N)):
    mod_N += pow(10, i, P)*int(N[i])
    mod_N %= P
if mod_N == 0:
    if int(M) > 0:
        print(0)
    else:
        print(1)
    exit
else:
    M = M[::-1]
    mod_M = 0
    for i in range(len(M)):
        mod_M += pow(10, i, P-1)*int(M[i])
        mod_M %= (P-1)
    print(pow(mod_N, mod_M, P))
    exit
0