結果

問題 No.1595 The Final Digit
ユーザー 👑 H20H20
提出日時 2021-07-09 22:24:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 76,536 KB
最終ジャッジ日時 2023-09-14 09:39:11
合計ジャッジ時間 3,402 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,552 KB
testcase_01 AC 90 ms
71,432 KB
testcase_02 AC 91 ms
71,524 KB
testcase_03 AC 94 ms
71,924 KB
testcase_04 AC 90 ms
71,400 KB
testcase_05 AC 90 ms
71,616 KB
testcase_06 AC 91 ms
71,764 KB
testcase_07 AC 90 ms
71,712 KB
testcase_08 AC 91 ms
71,584 KB
testcase_09 AC 91 ms
71,536 KB
testcase_10 AC 90 ms
71,632 KB
testcase_11 AC 90 ms
71,568 KB
testcase_12 AC 96 ms
76,464 KB
testcase_13 AC 90 ms
71,616 KB
testcase_14 AC 97 ms
76,536 KB
testcase_15 AC 97 ms
76,536 KB
testcase_16 AC 91 ms
71,556 KB
testcase_17 AC 90 ms
71,580 KB
testcase_18 AC 92 ms
71,788 KB
testcase_19 AC 92 ms
71,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
d = 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+3
    A = [A[1],A[2],sum(A)%10]
print(A[-1])
0