結果

問題 No.1161 Many Powers
ユーザー yakeshiba
提出日時 2020-11-18 11:29:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 240 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 63,940 KB
最終ジャッジ日時 2024-07-23 08:54:09
合計ジャッジ時間 2,968 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, c = map(int,input().split())

ans = 0
cnt = -(-a//c)
over = a%c

#print(cnt)
#print(over)

for i in range(1,min(a,c)+1):
    if i <= over:
        ans += cnt*pow(i,b,c)
    else:
        ans += (cnt-1)*pow(i,b,c)
        
print(ans%c)
0