結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー yas_yasyu
提出日時 2022-07-15 21:33:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 228 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 26,604 KB
最終ジャッジ日時 2024-06-27 17:00:45
合計ジャッジ時間 3,915 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2 TLE * 1
other -- * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

A,N = map(int,input().split())
M = 10**7
def pow_r(x, n):
	if n == 0:
		return 1
	if n % 2 == 0:
		return pow_r(x ** 2, n // 2)%M
	else:  # standard case ② n is odd
		return x * pow_r(x ** 2, (n - 1) // 2)%M

print(pow_r(A,N))
0