結果

問題 No.251 大きな桁の復習問題(1)
ユーザー brthyyjpbrthyyjp
提出日時 2021-12-27 10:47:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 654 ms
コンパイル使用メモリ 81,732 KB
実行使用メモリ 100,400 KB
最終ジャッジ日時 2023-10-25 09:13:44
合計ジャッジ時間 2,904 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 66 ms
75,340 KB
testcase_03 AC 66 ms
75,340 KB
testcase_04 AC 65 ms
75,340 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 81 ms
89,196 KB
testcase_10 AC 94 ms
100,400 KB
testcase_11 AC 93 ms
100,400 KB
testcase_12 AC 93 ms
100,400 KB
testcase_13 AC 93 ms
100,400 KB
testcase_14 AC 92 ms
100,400 KB
testcase_15 AC 92 ms
100,400 KB
testcase_16 AC 93 ms
100,400 KB
testcase_17 AC 92 ms
100,400 KB
testcase_18 AC 91 ms
100,400 KB
testcase_19 AC 92 ms
100,400 KB
testcase_20 AC 64 ms
75,340 KB
testcase_21 AC 64 ms
75,340 KB
testcase_22 AC 64 ms
75,340 KB
testcase_23 AC 64 ms
75,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = str(input())
m = str(input())

if m == '0':
    print(0)
    exit()

if n == '0':
    print(1)
    exit()

mod = 129402307

N = 10**6
P0 = [0]*N
P0[0] = 1
for i in range(1, N):
    P0[i] = 10*P0[i-1]
    P0[i] %= mod

P1 = [0]*N
P1[0] = 1
for i in range(1, N):
    P1[i] = 10*P1[i-1]
    P1[i] %= mod-1

n = list(n)
m = list(m)
n.reverse()
m.reverse()
y = 0
for i, c in enumerate(m):
    y += int(c)*P1[i]
    y %= mod-1
x = 0
for i, c in enumerate(n):
    x += int(c)*P0[i]
    x %= mod
if x == 0:
    print(0)
    exit()
ans = pow(x, y, mod)
print(ans)
0