結果

問題 No.1706 Many Bus Stops (hard)
ユーザー gew1fw
提出日時 2025-06-12 21:45:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 463 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 54,116 KB
最終ジャッジ日時 2025-06-12 21:49:44
合計ジャッジ時間 3,067 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other WA * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9 + 7

def main():
    import sys
    input = sys.stdin.read().split()
    C = int(input[0])
    N = int(input[1])
    M = int(input[2])
    
    a = pow(C, N, MOD)
    numerator = (a - 1) % MOD
    denominator = a
    inv_denominator = pow(denominator, MOD-2, MOD)
    q = (numerator * inv_denominator) % MOD
    q_pow = pow(q, M, MOD)
    ans = (1 - q_pow) % MOD
    if ans < 0:
        ans += MOD
    print(ans)

if __name__ == "__main__":
    main()
0