結果

問題 No.167 N^M mod 10
ユーザー あかりきあかりき
提出日時 2021-03-01 18:48:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 46 ms / 1,000 ms
コード長 300 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 61,660 KB
最終ジャッジ日時 2024-04-14 03:47:04
合計ジャッジ時間 2,400 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,392 KB
testcase_01 AC 37 ms
52,532 KB
testcase_02 AC 45 ms
60,012 KB
testcase_03 AC 44 ms
60,504 KB
testcase_04 AC 46 ms
61,368 KB
testcase_05 AC 37 ms
52,820 KB
testcase_06 AC 37 ms
52,448 KB
testcase_07 AC 36 ms
52,000 KB
testcase_08 AC 36 ms
52,864 KB
testcase_09 AC 37 ms
52,548 KB
testcase_10 AC 39 ms
51,944 KB
testcase_11 AC 37 ms
51,824 KB
testcase_12 AC 37 ms
52,272 KB
testcase_13 AC 36 ms
53,160 KB
testcase_14 AC 36 ms
53,200 KB
testcase_15 AC 37 ms
52,252 KB
testcase_16 AC 38 ms
52,344 KB
testcase_17 AC 36 ms
52,984 KB
testcase_18 AC 36 ms
52,208 KB
testcase_19 AC 36 ms
53,140 KB
testcase_20 AC 36 ms
53,080 KB
testcase_21 AC 37 ms
51,880 KB
testcase_22 AC 46 ms
61,232 KB
testcase_23 AC 45 ms
61,660 KB
testcase_24 AC 45 ms
60,584 KB
testcase_25 AC 46 ms
60,980 KB
testcase_26 AC 38 ms
53,816 KB
testcase_27 AC 45 ms
60,600 KB
testcase_28 AC 46 ms
60,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=list(input())
m=list(input())

if len(m)==1 and m[0]=='0':
  print(1)
  exit()

n=int(n[-1])
l=[n]
for i in range(100):
  if l[-1]*n%10!=l[0]:
    l.append(l[-1]*n%10)
  else:
    break

ct=0
m.reverse()
for i in range(len(m)):
  ct+=int(m[i])*pow(10,i,len(l))
  ct%=len(l)

print(l[(ct-1)%len(l)])
0