結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
rocoder
|
| 提出日時 | 2017-07-07 04:04:29 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 369 bytes |
| コンパイル時間 | 514 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-10-06 04:42:29 |
| 合計ジャッジ時間 | 1,828 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 11 WA * 6 RE * 10 |
ソースコード
#167 N^Mmod10
N=int(input())
M=int(input())
a=1
N%=10
c=0
T=[0]*10
S=[-1]*10
while M>0 and T[a]<2:
a*=N
a%=10
M-=1
T[a]+=1
if S[a]==-1:
S[a]=c
c+=1
# print (a)
#rint (M)
if M==0:
print(a)
else:
M+=c-S[a]
# print (M)
M%=c-S[a]-1
# print (M)
a=1
while M>0:
a*=N
a%=10
M-=1
print (a)
rocoder