結果

問題 No.1275 綺麗な式
ユーザー ygd.ygd.
提出日時 2020-11-25 00:38:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 395 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 29,628 KB
最終ジャッジ日時 2023-10-01 01:24:34
合計ジャッジ時間 10,649 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
29,324 KB
testcase_01 AC 134 ms
29,328 KB
testcase_02 AC 135 ms
29,428 KB
testcase_03 AC 134 ms
29,548 KB
testcase_04 AC 134 ms
29,528 KB
testcase_05 AC 133 ms
29,368 KB
testcase_06 AC 133 ms
29,356 KB
testcase_07 AC 133 ms
29,352 KB
testcase_08 AC 134 ms
29,424 KB
testcase_09 AC 133 ms
29,400 KB
testcase_10 AC 133 ms
29,348 KB
testcase_11 AC 134 ms
29,244 KB
testcase_12 AC 137 ms
29,388 KB
testcase_13 AC 137 ms
29,324 KB
testcase_14 AC 134 ms
29,436 KB
testcase_15 AC 137 ms
29,396 KB
testcase_16 AC 137 ms
29,552 KB
testcase_17 AC 134 ms
29,508 KB
testcase_18 AC 135 ms
29,428 KB
testcase_19 AC 134 ms
29,292 KB
testcase_20 AC 134 ms
29,288 KB
testcase_21 AC 137 ms
29,400 KB
testcase_22 AC 136 ms
29,320 KB
testcase_23 AC 135 ms
29,420 KB
testcase_24 AC 135 ms
29,628 KB
testcase_25 AC 139 ms
29,364 KB
testcase_26 AC 137 ms
29,280 KB
testcase_27 AC 134 ms
29,416 KB
testcase_28 AC 137 ms
29,356 KB
testcase_29 AC 133 ms
29,300 KB
testcase_30 AC 135 ms
29,432 KB
testcase_31 AC 141 ms
29,460 KB
testcase_32 AC 137 ms
29,484 KB
testcase_33 AC 134 ms
29,280 KB
testcase_34 AC 133 ms
29,392 KB
testcase_35 AC 136 ms
29,400 KB
testcase_36 AC 135 ms
29,424 KB
testcase_37 AC 133 ms
29,236 KB
testcase_38 AC 133 ms
29,396 KB
testcase_39 AC 135 ms
29,240 KB
testcase_40 AC 133 ms
29,424 KB
testcase_41 AC 134 ms
29,396 KB
testcase_42 AC 133 ms
29,380 KB
testcase_43 AC 134 ms
29,388 KB
testcase_44 AC 134 ms
29,396 KB
testcase_45 AC 134 ms
29,432 KB
testcase_46 AC 132 ms
29,288 KB
testcase_47 AC 135 ms
29,504 KB
testcase_48 AC 135 ms
29,388 KB
testcase_49 AC 136 ms
29,512 KB
testcase_50 AC 138 ms
29,440 KB
testcase_51 AC 138 ms
29,428 KB
testcase_52 AC 134 ms
29,388 KB
testcase_53 AC 134 ms
29,420 KB
testcase_54 AC 135 ms
29,424 KB
testcase_55 AC 134 ms
29,444 KB
testcase_56 AC 137 ms
29,436 KB
testcase_57 AC 137 ms
29,188 KB
testcase_58 AC 134 ms
29,388 KB
testcase_59 AC 135 ms
29,340 KB
testcase_60 AC 136 ms
29,500 KB
testcase_61 AC 136 ms
29,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
MOD = pow(10,9)+7
a,b = map(int,input().split())
n = int(input())
A = np.array([[a, b], [1, a]])
#print(A)
MAX = 70
L = [A]
for i in range(MAX):
  A = np.dot(A,A)
  A = np.mod(A, MOD)
  #print(A)
  L.append(A)
#print(L)
#print(B)
X = np.array([[1, 0], [0, 1]])
for i in range(MAX):
  if (n>>i)&1 == 1:
    X = np.dot(X,L[i])
    X = np.mod(X,MOD)
ans = X[0,0]*2
print(ans%MOD)
0