結果

問題 No.1161 Many Powers
ユーザー 双六双六
提出日時 2020-08-19 03:54:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 62,340 KB
最終ジャッジ日時 2024-04-20 08:09:59
合計ジャッジ時間 2,793 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,500 KB
testcase_01 AC 42 ms
54,544 KB
testcase_02 AC 40 ms
53,604 KB
testcase_03 AC 41 ms
55,132 KB
testcase_04 AC 42 ms
54,696 KB
testcase_05 AC 50 ms
61,084 KB
testcase_06 AC 49 ms
61,240 KB
testcase_07 AC 41 ms
55,164 KB
testcase_08 AC 80 ms
61,424 KB
testcase_09 AC 85 ms
62,340 KB
testcase_10 AC 65 ms
60,880 KB
testcase_11 AC 73 ms
61,816 KB
testcase_12 AC 59 ms
60,888 KB
testcase_13 AC 93 ms
61,884 KB
testcase_14 AC 114 ms
61,572 KB
testcase_15 AC 109 ms
60,972 KB
testcase_16 AC 124 ms
61,448 KB
testcase_17 AC 97 ms
60,568 KB
testcase_18 AC 83 ms
62,076 KB
testcase_19 AC 67 ms
61,860 KB
testcase_20 AC 124 ms
61,372 KB
testcase_21 AC 68 ms
61,064 KB
testcase_22 AC 119 ms
60,368 KB
testcase_23 AC 39 ms
55,188 KB
testcase_24 AC 40 ms
53,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	A, B, C = getlist()
	ans = 0
	for i in range(1, C):
		if i <= A % C:
			ans += pow(i, B, C) * (int(A // C) + 1)
		else:
			ans += pow(i, B, C) * int(A // C)

	print(ans % C)

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