結果

問題 No.1161 Many Powers
ユーザー lam6er
提出日時 2025-03-20 20:35:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 293 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,700 KB
実行使用メモリ 64,464 KB
最終ジャッジ日時 2025-03-20 20:37:21
合計ジャッジ時間 3,055 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

A, B, C = map(int, input().split())

if C == 1:
    print(0)
else:
    k = A // C
    rem = A % C
    total = 0
    for r in range(1, C):
        count = k
        if r <= rem:
            count += 1
        power = pow(r, B, C)
        total = (total + power * count) % C
    print(total % C)
0