結果

問題 No.1161 Many Powers
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2021-12-13 06:03:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 727 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 10,548 KB
実行使用メモリ 8,248 KB
最終ジャッジ日時 2023-09-29 04:58:20
合計ジャッジ時間 6,996 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,248 KB
testcase_01 AC 17 ms
8,200 KB
testcase_02 AC 16 ms
7,784 KB
testcase_03 AC 18 ms
7,832 KB
testcase_04 AC 16 ms
7,972 KB
testcase_05 AC 35 ms
7,848 KB
testcase_06 AC 42 ms
7,844 KB
testcase_07 AC 16 ms
7,844 KB
testcase_08 AC 252 ms
7,728 KB
testcase_09 AC 282 ms
7,832 KB
testcase_10 AC 110 ms
7,796 KB
testcase_11 AC 187 ms
7,768 KB
testcase_12 AC 99 ms
7,940 KB
testcase_13 AC 332 ms
7,796 KB
testcase_14 AC 630 ms
7,784 KB
testcase_15 AC 466 ms
7,784 KB
testcase_16 AC 536 ms
7,788 KB
testcase_17 AC 382 ms
7,856 KB
testcase_18 AC 264 ms
7,936 KB
testcase_19 AC 153 ms
7,836 KB
testcase_20 AC 727 ms
7,812 KB
testcase_21 AC 109 ms
7,848 KB
testcase_22 AC 399 ms
7,856 KB
testcase_23 AC 17 ms
8,092 KB
testcase_24 AC 16 ms
8,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B,C = map(int,input().split())
S = 0
mod = C
if A<C:
    for i in range(1,A+1):
        S += pow(i,B,C)
        S %= mod
    print(S)
    exit()
    
for i in range(1,C+1):
    S += pow(i,B,C)
    S %= mod

q = A//C
r = A%C
T = 0
for i in range(1,r+1):
    T += pow(i,B,C)
    T %= C
print((S*q + T) %C)
0