結果

問題 No.16 累乗の加算
ユーザー suppy193suppy193
提出日時 2016-11-02 11:08:16
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 542 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 20,736 KB
実行使用メモリ 8,224 KB
最終ジャッジ日時 2024-05-03 21:01:15
合計ジャッジ時間 6,681 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,816 KB
testcase_01 AC 0 ms
6,944 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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%lld%lld", &x, &n);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
main.c:12:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%lld", &a[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~

ソースコード

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