結果

問題 No.16 累乗の加算
ユーザー tookunn_1213tookunn_1213
提出日時 2015-08-20 14:23:18
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 274 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 6,668 KB
実行使用メモリ 24,220 KB
最終ジャッジ日時 2023-09-25 13:48:54
合計ジャッジ時間 6,891 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
10,464 KB
testcase_01 AC 11 ms
5,864 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def power(a,b):
	if b == 0:return 1
	if b == 1:return a
	if b % 2 != 0:
		return a * power(a,b - 1)
	c = power(a,b/2)
	return c * c
x,N = map(int,raw_input().split())
a = map(int,raw_input().split())
ans = 0
for i in range(N):
	ans += power(x,a[i])
	ans %= 1000003
print ans
0