結果

問題 No.1275 綺麗な式
ユーザー mkawa2mkawa2
提出日時 2021-09-02 01:31:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,326 bytes
コンパイル時間 653 ms
コンパイル使用メモリ 11,156 KB
実行使用メモリ 12,780 KB
最終ジャッジ日時 2023-08-19 08:46:15
合計ジャッジ時間 7,637 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,164 KB
testcase_01 AC 17 ms
8,104 KB
testcase_02 AC 17 ms
8,096 KB
testcase_03 AC 17 ms
8,052 KB
testcase_04 AC 17 ms
8,176 KB
testcase_05 AC 17 ms
8,052 KB
testcase_06 AC 17 ms
8,072 KB
testcase_07 AC 17 ms
8,072 KB
testcase_08 AC 17 ms
8,048 KB
testcase_09 AC 18 ms
8,096 KB
testcase_10 AC 17 ms
8,096 KB
testcase_11 AC 17 ms
8,048 KB
testcase_12 AC 17 ms
8,136 KB
testcase_13 AC 17 ms
8,104 KB
testcase_14 AC 17 ms
8,052 KB
testcase_15 AC 17 ms
8,132 KB
testcase_16 AC 17 ms
8,092 KB
testcase_17 AC 17 ms
8,136 KB
testcase_18 AC 17 ms
8,092 KB
testcase_19 AC 17 ms
8,096 KB
testcase_20 AC 17 ms
8,100 KB
testcase_21 AC 17 ms
8,052 KB
testcase_22 AC 17 ms
8,092 KB
testcase_23 AC 17 ms
8,072 KB
testcase_24 AC 17 ms
8,048 KB
testcase_25 AC 17 ms
8,092 KB
testcase_26 AC 17 ms
8,128 KB
testcase_27 AC 16 ms
8,080 KB
testcase_28 AC 17 ms
8,100 KB
testcase_29 AC 17 ms
8,048 KB
testcase_30 AC 16 ms
8,100 KB
testcase_31 AC 17 ms
8,080 KB
testcase_32 AC 17 ms
8,080 KB
testcase_33 AC 17 ms
8,016 KB
testcase_34 AC 17 ms
8,048 KB
testcase_35 AC 17 ms
8,080 KB
testcase_36 AC 17 ms
8,184 KB
testcase_37 AC 16 ms
8,088 KB
testcase_38 AC 17 ms
8,092 KB
testcase_39 AC 17 ms
8,140 KB
testcase_40 TLE -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**9
# md = 998244353
md = 10**9+7

def dot(aa, bb):
    h = len(aa)
    w = len(bb[0])
    res = [[0]*w for _ in range(h)]
    for i, row in enumerate(aa):
        for j, col in enumerate(zip(*bb)):
            v = 0
            # for a, b in zip(row, col): v += a*b
            # res[i][j] = v%md
            for a, b in zip(row, col): v += a*b%md
            res[i][j] = v%md
    return res

def matpow(mat, e):
    n = len(mat)
    res = [[1 if i == j else 0 for j in range(n)] for i in range(n)]
    while e:
        if e & 1: res = dot(res, mat)
        mat = dot(mat, mat)
        e >>= 1
    return res

a, b = LI()
s = (a**2-b)%md
n = II()

mat = [[2*a, 1],
       [-s, 0]]

cc = matpow(mat, n-1)
ans = dot([[2*a, 2]], cc)
print(ans[0][0])
0