結果

問題 No.1595 The Final Digit
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-07-09 21:36:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 212 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 71,480 KB
最終ジャッジ日時 2023-09-14 08:01:34
合計ジャッジ時間 2,608 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,152 KB
testcase_01 AC 67 ms
71,160 KB
testcase_02 AC 64 ms
71,452 KB
testcase_03 AC 64 ms
71,196 KB
testcase_04 AC 65 ms
71,352 KB
testcase_05 AC 65 ms
71,472 KB
testcase_06 AC 65 ms
71,356 KB
testcase_07 AC 65 ms
71,480 KB
testcase_08 AC 66 ms
71,112 KB
testcase_09 AC 66 ms
71,304 KB
testcase_10 AC 65 ms
71,416 KB
testcase_11 AC 63 ms
71,304 KB
testcase_12 AC 67 ms
71,352 KB
testcase_13 AC 67 ms
71,360 KB
testcase_14 AC 65 ms
71,308 KB
testcase_15 AC 67 ms
71,372 KB
testcase_16 AC 66 ms
71,196 KB
testcase_17 AC 65 ms
71,204 KB
testcase_18 AC 68 ms
71,096 KB
testcase_19 AC 66 ms
71,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p,q,r,K = map(int,input().split())

p %= 10
q %= 10
r %= 10

s = set()

A = [p,q,r]

while (p,q,r) not in s:

    s.add( (p,q,r) )
    p,q,r = q,r,(p+q+r) % 10
    A.append(r)

X = len(A)-3
print (A[(K-1) % X])
0