結果
| 問題 |
No.1595 The Final Digit
|
| ユーザー |
とりゐ
|
| 提出日時 | 2021-07-09 21:46:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 729 bytes |
| コンパイル時間 | 155 ms |
| コンパイル使用メモリ | 82,220 KB |
| 実行使用メモリ | 65,268 KB |
| 最終ジャッジ日時 | 2024-07-01 15:49:11 |
| 合計ジャッジ時間 | 1,742 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 RE * 1 |
ソースコード
import sys
import math
from collections import deque,Counter
#sys.setrecursionlimit(10**7)
int1=lambda x: int(x)-1
mi=lambda :map(int,input().split())
li=lambda :list(mi())
mi1=lambda :map(int1,input().split())
li1=lambda :list(mi1())
mis=lambda :map(str,input().split())
lis=lambda :list(mis())
from collections import defaultdict
"""
d=defaultdict(int) #初期値 0
d=defaultdict(lambda:1) #初期値 1
"""
mod=10**9+7
Mod=998244353
INF=10**18
ans=0
p,q,r,k=mi()
p%=10
q%=10
r%=10
a=[(p,q,r)]
while True:
p,q,r=q,r,(p+q+r)%10
if (p,q,r) in a:
x=a.index((p,q,r))
y=len(a)
if y>=k-3:
print(a[k-3][2])
exit()
m=k-x-3
n=m%(y-x)
print(a[x+n][2])
exit()
else:
a.append((p,q,r))
とりゐ