結果

問題 No.1161 Many Powers
ユーザー 👑 tamatotamato
提出日時 2020-11-22 20:48:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 87,448 KB
実行使用メモリ 76,304 KB
最終ジャッジ日時 2023-09-30 23:04:58
合計ジャッジ時間 4,864 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,644 KB
testcase_01 AC 67 ms
71,908 KB
testcase_02 AC 66 ms
71,656 KB
testcase_03 AC 68 ms
71,840 KB
testcase_04 AC 69 ms
71,928 KB
testcase_05 AC 78 ms
75,864 KB
testcase_06 AC 78 ms
76,060 KB
testcase_07 AC 66 ms
71,720 KB
testcase_08 AC 126 ms
75,928 KB
testcase_09 AC 135 ms
76,056 KB
testcase_10 AC 100 ms
76,072 KB
testcase_11 AC 118 ms
75,872 KB
testcase_12 AC 93 ms
76,304 KB
testcase_13 AC 152 ms
76,012 KB
testcase_14 AC 197 ms
75,856 KB
testcase_15 AC 170 ms
75,872 KB
testcase_16 AC 179 ms
75,928 KB
testcase_17 AC 152 ms
76,180 KB
testcase_18 AC 134 ms
76,112 KB
testcase_19 AC 109 ms
76,172 KB
testcase_20 AC 220 ms
76,168 KB
testcase_21 AC 98 ms
75,756 KB
testcase_22 AC 149 ms
76,104 KB
testcase_23 AC 65 ms
71,456 KB
testcase_24 AC 66 ms
71,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    a, b, c = map(int, input().split())
    ans = 0
    for i in range(1, c + 1):
        ans = (ans + pow(i, b, c)) % c
    ans = (ans * (a // c)) % c
    for i in range(1, a % c + 1):
        ans = (ans + pow(i, b, c))%c
    print(ans)


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