結果

問題 No.1595 The Final Digit
ユーザー nehan_der_thalnehan_der_thal
提出日時 2021-07-09 21:40:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 324 bytes
コンパイル時間 791 ms
コンパイル使用メモリ 10,940 KB
実行使用メモリ 29,712 KB
最終ジャッジ日時 2023-09-14 08:12:06
合計ジャッジ時間 5,846 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
29,660 KB
testcase_01 AC 140 ms
29,656 KB
testcase_02 AC 136 ms
29,608 KB
testcase_03 AC 137 ms
29,636 KB
testcase_04 AC 137 ms
29,600 KB
testcase_05 AC 139 ms
29,560 KB
testcase_06 AC 140 ms
29,564 KB
testcase_07 AC 137 ms
29,624 KB
testcase_08 AC 142 ms
29,512 KB
testcase_09 AC 141 ms
29,516 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 142 ms
29,636 KB
testcase_13 AC 140 ms
29,664 KB
testcase_14 AC 141 ms
29,692 KB
testcase_15 AC 141 ms
29,668 KB
testcase_16 AC 141 ms
29,604 KB
testcase_17 AC 141 ms
29,564 KB
testcase_18 AC 145 ms
29,572 KB
testcase_19 AC 142 ms
29,712 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,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-1)%3])

0