結果
問題 |
No.1258 コインゲーム
|
ユーザー |
![]() |
提出日時 | 2022-04-24 11:02:58 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 457 bytes |
コンパイル時間 | 323 ms |
コンパイル使用メモリ | 82,052 KB |
実行使用メモリ | 78,904 KB |
最終ジャッジ日時 | 2024-06-25 21:20:10 |
合計ジャッジ時間 | 8,000 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 49 |
ソースコード
mod = 7+10**9 def ncr(n,c,mod): x = 1 y = 1 for i in range(n-c+1,n+1): x = x*i%mod for j in range(1,c+1): y = y*j%mod return (x * pow(y, mod-2, mod)) % mod S = int(input()) for _ in range(S): n, m, x = map(int, input().split()) count = 0 if x == 1: count = 1 else: count = 2 ans = 0 point = 0 while count <= n: point += (ncr(n, count, mod) * pow(m, count, mod)) point %= mod count += 2 print(point%mod)