結果

問題 No.1595 The Final Digit
ユーザー nehan_der_thalnehan_der_thal
提出日時 2021-07-09 23:02:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,820 KB
実行使用メモリ 29,616 KB
最終ジャッジ日時 2023-09-14 10:34:30
合計ジャッジ時間 4,929 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
29,504 KB
testcase_01 AC 135 ms
29,452 KB
testcase_02 AC 135 ms
29,488 KB
testcase_03 AC 135 ms
29,460 KB
testcase_04 AC 134 ms
29,596 KB
testcase_05 AC 136 ms
29,480 KB
testcase_06 AC 139 ms
29,532 KB
testcase_07 AC 135 ms
29,348 KB
testcase_08 AC 134 ms
29,552 KB
testcase_09 AC 134 ms
29,584 KB
testcase_10 AC 135 ms
29,464 KB
testcase_11 AC 136 ms
29,616 KB
testcase_12 AC 137 ms
29,572 KB
testcase_13 AC 136 ms
29,540 KB
testcase_14 AC 136 ms
29,568 KB
testcase_15 AC 137 ms
29,476 KB
testcase_16 AC 136 ms
29,504 KB
testcase_17 AC 136 ms
29,600 KB
testcase_18 AC 137 ms
29,476 KB
testcase_19 AC 136 ms
29,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
p, q, r, K = map(int, input().split())

xs = [[1,1,1],[1,2,2],[2,3,4]]
X = np.array(xs, dtype="object")
S = np.array([p,q,r], dtype="object")
K,m=divmod(K-1,3)
for _ in range(60):
    if K%2:
        S = np.dot(X, S)%10
    K = K//2
    X = np.dot(X, X)%10
S = np.array(S, dtype="int64")
print(S[m])

0