結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
あかりき
|
| 提出日時 | 2021-03-01 18:48:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 50 ms / 1,000 ms |
| コード長 | 300 bytes |
| コンパイル時間 | 161 ms |
| コンパイル使用メモリ | 82,248 KB |
| 実行使用メモリ | 60,288 KB |
| 最終ジャッジ日時 | 2024-10-03 00:56:06 |
| 合計ジャッジ時間 | 2,312 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
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)])
あかりき