結果

問題 No.16 累乗の加算
ユーザー suppy193suppy193
提出日時 2016-11-02 11:08:16
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 542 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 24,120 KB
実行使用メモリ 5,896 KB
最終ジャッジ日時 2023-08-16 12:35:49
合計ジャッジ時間 6,897 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,380 KB
testcase_01 AC 1 ms
4,380 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 #

#include <stdio.h>

int main(void) {
	long long int x, n;
	long long int a[101];
	long long int i, j;
	long long int total = 0;
	long long int subtotal;
	
	scanf("%lld%lld", &x, &n);
	for(i = 1;i <= n;i++){
		scanf("%lld", &a[i]);
	}
	for(i = 1;i <= n;i++){
		subtotal= 1;
		for(j = 0;j < a[i];j++){
			subtotal = ((subtotal % 1000003) * (x % 10000003)) % 1000003;
		}
		//printf("subtotal = %lld\n", subtotal);
		total = (total + subtotal) % 1000003;
	}
	//printf("total = %lld\n", total % 1000003);
	printf("%lld\n", total);
	
	return 0;
}
0