結果

問題 No.167 N^M mod 10
ユーザー work-furukawa
提出日時 2025-04-22 00:18:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 236 bytes
コンパイル時間 504 ms
コンパイル使用メモリ 82,280 KB
実行使用メモリ 54,116 KB
最終ジャッジ日時 2025-04-22 00:18:27
合計ジャッジ時間 2,954 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.set_int_max_str_digits(0)
N = input()
M = input()

if M == "0":
  print(1)
  exit()
if N == "0":
  print(0)
  exit()

N = int(N[-1])
if len(M) > 1:
  M = int(M[-2:])
else:
  M = int(M[-1])

ans = pow(N, M, 10)
print(ans)
0