結果
| 問題 | No.251 大きな桁の復習問題(1) | 
| コンテスト | |
| ユーザー |  Chihaya_chan | 
| 提出日時 | 2020-08-11 23:34:41 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 132 ms / 5,000 ms | 
| コード長 | 405 bytes | 
| コンパイル時間 | 355 ms | 
| コンパイル使用メモリ | 82,556 KB | 
| 実行使用メモリ | 70,300 KB | 
| 最終ジャッジ日時 | 2024-10-09 11:55:59 | 
| 合計ジャッジ時間 | 2,947 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
# 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
            
            
            
        