結果

問題 No.1595 The Final Digit
ユーザー hir355hir355
提出日時 2021-07-09 21:37:23
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 249 ms
使用メモリ 80,676 KB
最終ジャッジ日時 2023-02-01 22:26:51
合計ジャッジ時間 3,162 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 87 ms
80,012 KB
testcase_01 AC 88 ms
80,560 KB
testcase_02 AC 87 ms
80,372 KB
testcase_03 AC 88 ms
80,544 KB
testcase_04 AC 87 ms
80,368 KB
testcase_05 AC 87 ms
80,556 KB
testcase_06 AC 86 ms
80,432 KB
testcase_07 AC 87 ms
80,396 KB
testcase_08 AC 88 ms
80,676 KB
testcase_09 AC 86 ms
80,364 KB
testcase_10 AC 87 ms
80,568 KB
testcase_11 AC 87 ms
80,204 KB
testcase_12 AC 88 ms
80,364 KB
testcase_13 AC 89 ms
80,144 KB
testcase_14 AC 87 ms
80,572 KB
testcase_15 AC 87 ms
80,236 KB
testcase_16 AC 87 ms
80,344 KB
testcase_17 AC 88 ms
80,344 KB
testcase_18 AC 87 ms
80,584 KB
testcase_19 AC 87 ms
80,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p, q, r, k = map(int, input().split())
t = [[0] * 1000 for _ in range(64)]
for j in range(1000):
    t[0][j] = (j % 10 + j // 10 % 10 + j // 100) % 10 + j * 10 % 1000
for i in range(63):
    for j in range(1000):
        t[i + 1][j] = t[i][t[i][j]]
k -= 3
p %= 10
q %= 10
r %= 10
x = p * 100 + q * 10 + r
for i in range(64):
    if (k >> i) & 1:
        x = t[i][x]
print(x % 10)
0