結果
| 問題 |
No.1258 コインゲーム
|
| コンテスト | |
| ユーザー |
AEn
|
| 提出日時 | 2022-09-02 00:18:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 450 ms / 2,000 ms |
| コード長 | 272 bytes |
| コンパイル時間 | 307 ms |
| コンパイル使用メモリ | 82,444 KB |
| 実行使用メモリ | 77,864 KB |
| 最終ジャッジ日時 | 2024-11-14 16:41:21 |
| 合計ジャッジ時間 | 19,653 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
S = int(input())
mod = 10**9+7
inv = pow(2, mod-2, mod)
for i in range(S):
N, M, X = map(int,input().split())
a = pow(M+1, N, mod)
b = pow(1-M, N, mod)
c = (a+b)%mod
c *= inv
c %= mod
if X==0:
print(c)
else:
print((a-c)%mod)
AEn