結果

問題 No.16 累乗の加算
ユーザー TLwiegehttTLwiegehtt
提出日時 2015-07-12 23:31:44
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 495 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 23,812 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-22 14:36:00
合計ジャッジ時間 828 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#define MOD	(1000003);

int main(void){
	int i;
	int x,n;
	long long int sum = 0;
	long long int mul = 1;
	long long int arr[10005];
	
	scanf("%lld %d", &x, &n);
	
	for(i=0;i<=10000;i++){
		arr[i] = mul % MOD;
		mul = (mul*x) % MOD;
	}
	for(i=0;i<n;i++){
		long long int a;
		mul = 1;
		scanf("%lld", &a);
		
		while(10000 < a){
			mul = (mul * arr[10000]) % MOD;
			a -= 10000;
		}
		
		mul = (mul * arr[(int)a]) % MOD;
		sum += mul;
	}
	
	printf("%lld\n", sum);
	return 0;
}
0