結果

問題 No.1161 Many Powers
ユーザー yakeshibayakeshiba
提出日時 2020-11-18 11:29:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 240 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 76,408 KB
最終ジャッジ日時 2023-09-30 14:53:34
合計ジャッジ時間 4,375 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,276 KB
testcase_01 AC 72 ms
71,208 KB
testcase_02 AC 71 ms
71,468 KB
testcase_03 AC 73 ms
71,360 KB
testcase_04 AC 72 ms
71,544 KB
testcase_05 AC 82 ms
76,252 KB
testcase_06 AC 80 ms
76,000 KB
testcase_07 AC 70 ms
71,468 KB
testcase_08 AC 113 ms
75,956 KB
testcase_09 AC 117 ms
76,212 KB
testcase_10 AC 94 ms
75,920 KB
testcase_11 AC 106 ms
76,104 KB
testcase_12 AC 92 ms
76,244 KB
testcase_13 AC 127 ms
76,140 KB
testcase_14 AC 151 ms
76,260 KB
testcase_15 AC 144 ms
76,072 KB
testcase_16 AC 159 ms
76,104 KB
testcase_17 AC 132 ms
76,240 KB
testcase_18 AC 117 ms
76,220 KB
testcase_19 AC 101 ms
76,116 KB
testcase_20 AC 161 ms
76,408 KB
testcase_21 AC 102 ms
76,108 KB
testcase_22 AC 154 ms
76,196 KB
testcase_23 AC 71 ms
71,276 KB
testcase_24 AC 73 ms
71,528 KB
権限があれば一括ダウンロードができます

ソースコード

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