結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー koma3tabi3
提出日時 2018-01-03 23:55:27
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 207 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 22,656 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 02:34:20
合計ジャッジ時間 2,992 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 1 WA * 6 RE * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long unsigned int*’ [-Wformat=]
   12 |                 scanf("%d,",&A[i]);
      |                        ~^   ~~~~~
      |                         |   |
      |                         |   long unsigned int*
      |                         int*
      |                        %ld
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d\n",&N);
      |         ~~~~~^~~~~~~~~~~
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%d,",&A[i]);
      |                 ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void)
{
	int N,i,sum;
	scanf("%d\n",&N);
	
	sum=0;
	long unsigned int A[50000];

	for (i=1;i<=N;i++){
		scanf("%d,",&A[i]);
		sum+=A[i];	
	};

	printf("%d\n",sum);

	return 0;

}
0