結果

問題 No.1595 The Final Digit
ユーザー convexineqconvexineq
提出日時 2021-07-09 21:54:43
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 198 bytes
コンパイル時間 263 ms
使用メモリ 75,820 KB
最終ジャッジ日時 2023-02-01 23:14:40
合計ジャッジ時間 3,175 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 82 ms
75,724 KB
testcase_01 AC 82 ms
75,684 KB
testcase_02 AC 82 ms
75,808 KB
testcase_03 AC 82 ms
75,492 KB
testcase_04 AC 83 ms
75,660 KB
testcase_05 AC 83 ms
75,440 KB
testcase_06 AC 82 ms
75,552 KB
testcase_07 AC 82 ms
75,500 KB
testcase_08 AC 82 ms
75,436 KB
testcase_09 AC 82 ms
75,488 KB
testcase_10 AC 82 ms
75,444 KB
testcase_11 AC 84 ms
75,724 KB
testcase_12 AC 82 ms
75,668 KB
testcase_13 AC 83 ms
75,440 KB
testcase_14 AC 81 ms
75,740 KB
testcase_15 AC 82 ms
75,536 KB
testcase_16 AC 83 ms
75,748 KB
testcase_17 AC 82 ms
75,808 KB
testcase_18 AC 82 ms
75,820 KB
testcase_19 AC 82 ms
75,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p,q,r,K = map(int,input().split())
dp = [p%10,q%10,r%10]
while True:
    dp.append(sum(dp[-3:])%10)
    if dp[:3] == dp[-3:]:
        break
for _ in range(3): dp.pop()
L = len(dp)
print(dp[(K-1)%L])
0