結果

問題 No.16 累乗の加算
コンテスト
ユーザー suppy193
提出日時 2016-11-02 11:08:16
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
TLE  
(最初)
実行時間 -
コード長 542 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 69 ms
コンパイル使用メモリ 21,576 KB
最終ジャッジ日時 2026-02-23 22:47:04
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function ‘main’:
main.c:19:17: error: C++ style comments are not allowed in ISO C90
   19 |                 //printf("subtotal = %lld\n", subtotal);
      |                 ^
main.c:19:17: note: (this will be reported only once per input file)
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 #
raw source code

#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