結果

問題 No.1706 Many Bus Stops (hard)
ユーザー qwewe
提出日時 2025-04-24 12:26:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 411 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 53,592 KB
最終ジャッジ日時 2025-04-24 12:27:20
合計ジャッジ時間 3,031 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other WA * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9 + 7

C, N, M = map(int, input().split())

# Compute (1/C)^N mod MOD
inv_C = pow(C, MOD-2, MOD)
inv_C_pow_N = pow(inv_C, N, MOD)

# Probability that a single bus is NOT at bus stop 1 after N steps
prob_not = (1 - inv_C_pow_N) % MOD

# Probability that all M buses are NOT at bus stop 1
prob_all_not = pow(prob_not, M, MOD)

# Result is 1 - prob_all_not
result = (1 - prob_all_not) % MOD
print(result)
0