結果

問題 No.1595 The Final Digit
ユーザー c-yanc-yan
提出日時 2021-07-09 23:49:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 353 bytes
コンパイル時間 539 ms
コンパイル使用メモリ 10,804 KB
実行使用メモリ 8,396 KB
最終ジャッジ日時 2023-09-14 11:15:13
合計ジャッジ時間 1,367 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,944 KB
testcase_01 AC 17 ms
8,296 KB
testcase_02 RE -
testcase_03 AC 17 ms
8,252 KB
testcase_04 WA -
testcase_05 AC 17 ms
8,220 KB
testcase_06 WA -
testcase_07 RE -
testcase_08 AC 17 ms
8,252 KB
testcase_09 AC 17 ms
8,172 KB
testcase_10 AC 17 ms
8,212 KB
testcase_11 AC 17 ms
8,228 KB
testcase_12 AC 17 ms
8,232 KB
testcase_13 AC 16 ms
8,340 KB
testcase_14 AC 17 ms
8,356 KB
testcase_15 AC 16 ms
8,296 KB
testcase_16 AC 17 ms
8,352 KB
testcase_17 AC 17 ms
8,328 KB
testcase_18 AC 17 ms
8,232 KB
testcase_19 AC 17 ms
8,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

A = {}
A[0] = p % 10
A[1] = q % 10
A[2] = r % 10


def conv(a, b, c):
    return (a % 10) * 100 + (b % 10) * 10 + c % 10


t = set()
t.add(conv(A[0], A[1], A[2]))
for k in range(3, 1000):
    A[k] = (A[k - 1] + A[k - 2] + A[k - 3]) % 10
    t.add(conv(A[k], A[k - 1], A[k - 2]))

print(A[(K - 1) % (len(t) - 1)])
0