結果

問題 No.1258 コインゲーム
ユーザー Eki1009Eki1009
提出日時 2020-10-16 22:16:00
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 645 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 104,336 KB
最終ジャッジ日時 2023-09-28 03:34:24
合計ジャッジ時間 66,493 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 533 ms
83,892 KB
testcase_01 AC 676 ms
85,484 KB
testcase_02 AC 305 ms
81,384 KB
testcase_03 AC 1,702 ms
98,480 KB
testcase_04 AC 1,825 ms
100,984 KB
testcase_05 AC 399 ms
82,832 KB
testcase_06 AC 1,377 ms
93,492 KB
testcase_07 AC 252 ms
82,260 KB
testcase_08 AC 226 ms
81,300 KB
testcase_09 AC 811 ms
87,800 KB
testcase_10 AC 1,658 ms
98,536 KB
testcase_11 AC 1,763 ms
100,660 KB
testcase_12 AC 1,408 ms
95,068 KB
testcase_13 AC 532 ms
84,036 KB
testcase_14 AC 277 ms
84,080 KB
testcase_15 AC 1,700 ms
98,340 KB
testcase_16 AC 416 ms
83,164 KB
testcase_17 AC 1,821 ms
100,080 KB
testcase_18 AC 716 ms
88,104 KB
testcase_19 AC 687 ms
86,208 KB
testcase_20 AC 1,449 ms
95,252 KB
testcase_21 AC 1,679 ms
99,812 KB
testcase_22 AC 1,225 ms
93,216 KB
testcase_23 AC 986 ms
89,712 KB
testcase_24 AC 480 ms
83,984 KB
testcase_25 AC 905 ms
89,280 KB
testcase_26 AC 812 ms
87,860 KB
testcase_27 AC 1,701 ms
98,280 KB
testcase_28 AC 593 ms
84,164 KB
testcase_29 AC 595 ms
85,304 KB
testcase_30 TLE -
testcase_31 AC 571 ms
85,216 KB
testcase_32 AC 358 ms
81,972 KB
testcase_33 AC 1,384 ms
96,088 KB
testcase_34 AC 1,825 ms
99,344 KB
testcase_35 AC 683 ms
86,292 KB
testcase_36 AC 1,696 ms
99,096 KB
testcase_37 AC 723 ms
86,984 KB
testcase_38 AC 1,600 ms
97,604 KB
testcase_39 AC 586 ms
84,340 KB
testcase_40 AC 1,982 ms
104,020 KB
testcase_41 AC 1,978 ms
104,092 KB
testcase_42 TLE -
testcase_43 TLE -
testcase_44 TLE -
testcase_45 AC 1,898 ms
103,528 KB
testcase_46 AC 1,966 ms
104,280 KB
testcase_47 AC 1,979 ms
104,100 KB
testcase_48 TLE -
testcase_49 AC 1,879 ms
104,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
mod = 10**9+7

def matprod(A, B):
    x = len(A)
    y = len(B)
    z = len(B[0])
    C = [[0]*z for _ in range(x)]
    for i in range(x):
        for j in range(y):
            for k in range(z):
                C[i][j] += A[i][k] * B[k][j]
                C[i][j] %= mod
    return C

def matpow(A, n):
    if n == 1:
        return A
    if n%2 == 0:
        B = matpow(A, n/2)
        return matprod(B, B)
    return matprod(A, matpow(A, n-1))

def f():
    n, m, x = map(int, input().split())
    X = [[1, m], [m, 1]]
    Y = matpow(X, n)
    print(Y[0][x])

s = int(input())
for _ in range(s):
    f()
0