結果
問題 | No.1595 The Final Digit |
ユーザー |
![]() |
提出日時 | 2021-07-09 22:24:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 50 ms / 2,000 ms |
コード長 | 423 bytes |
コンパイル時間 | 244 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 60,032 KB |
最終ジャッジ日時 | 2024-07-01 17:00:57 |
合計ジャッジ時間 | 1,947 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
import collectionsd = collections.defaultdict(int)p,q,r,K = map(int, input().split())A = [p%10,q%10,r%10]for i in range(K-3):if d[(A[1],A[2],sum(A)%10)]>0:temp = (K-d[(A[1],A[2],sum(A)%10)])%(i+3-d[(A[1],A[2],sum(A)%10)])for i in range(temp):A = [A[1],A[2],sum(A)%10]print(A[-1])exit()d[(A[1],A[2],sum(A)%10)]=i+3A = [A[1],A[2],sum(A)%10]print(A[-1])