結果

問題 No.1258 コインゲーム
ユーザー Kiri8128Kiri8128
提出日時 2020-10-16 21:47:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 478 ms / 2,000 ms
コード長 256 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 79,032 KB
最終ジャッジ日時 2023-09-28 02:43:05
合計ジャッジ時間 19,993 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 182 ms
78,608 KB
testcase_01 AC 202 ms
78,596 KB
testcase_02 AC 152 ms
78,476 KB
testcase_03 AC 410 ms
78,512 KB
testcase_04 AC 443 ms
78,516 KB
testcase_05 AC 166 ms
78,632 KB
testcase_06 AC 354 ms
78,656 KB
testcase_07 AC 142 ms
78,660 KB
testcase_08 AC 135 ms
78,532 KB
testcase_09 AC 234 ms
78,412 KB
testcase_10 AC 402 ms
78,804 KB
testcase_11 AC 432 ms
78,664 KB
testcase_12 AC 354 ms
78,496 KB
testcase_13 AC 189 ms
78,696 KB
testcase_14 AC 142 ms
78,664 KB
testcase_15 AC 393 ms
78,812 KB
testcase_16 AC 176 ms
78,324 KB
testcase_17 AC 454 ms
78,544 KB
testcase_18 AC 234 ms
78,472 KB
testcase_19 AC 228 ms
78,612 KB
testcase_20 AC 350 ms
78,808 KB
testcase_21 AC 419 ms
78,480 KB
testcase_22 AC 331 ms
78,824 KB
testcase_23 AC 270 ms
78,676 KB
testcase_24 AC 174 ms
78,644 KB
testcase_25 AC 263 ms
78,592 KB
testcase_26 AC 245 ms
78,732 KB
testcase_27 AC 408 ms
78,664 KB
testcase_28 AC 194 ms
78,488 KB
testcase_29 AC 197 ms
78,680 KB
testcase_30 AC 474 ms
78,616 KB
testcase_31 AC 205 ms
78,768 KB
testcase_32 AC 155 ms
78,660 KB
testcase_33 AC 353 ms
78,768 KB
testcase_34 AC 407 ms
78,416 KB
testcase_35 AC 220 ms
78,328 KB
testcase_36 AC 408 ms
78,592 KB
testcase_37 AC 231 ms
78,480 KB
testcase_38 AC 389 ms
78,740 KB
testcase_39 AC 193 ms
78,404 KB
testcase_40 AC 472 ms
78,592 KB
testcase_41 AC 478 ms
78,640 KB
testcase_42 AC 476 ms
78,668 KB
testcase_43 AC 474 ms
79,032 KB
testcase_44 AC 475 ms
78,500 KB
testcase_45 AC 467 ms
78,620 KB
testcase_46 AC 466 ms
78,784 KB
testcase_47 AC 470 ms
78,752 KB
testcase_48 AC 470 ms
78,584 KB
testcase_49 AC 468 ms
78,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

P = 10 ** 9 + 7
i2 = P + 1 >> 1
S = int(input())
for _ in range(S):
    N, M, X = map(int, input().split())
    if X == 0:
        print((pow(1 + M, N, P) + pow(1 - M, N, P)) * i2 % P)
    else:
        print((pow(1 + M, N, P) - pow(1 - M, N, P)) * i2 % P)
0