結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー Shimizudes
提出日時 2018-07-06 20:08:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 323 bytes
コンパイル時間 386 ms
コンパイル使用メモリ 55,440 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-01 02:52:46
合計ジャッジ時間 2,497 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 7 RE * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:21: warning: ‘sum’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   17 |                 sum += a[i];
      |                 ~~~~^~~~~~~

ソースコード

diff #

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(void) {
	long long n,sum,a[50000];
	
	cin >>n;
	
	for(int i=0;i<n; i++ )
	{
		cin >>a[i];
	}
		
	for(int i=0;i<n; i++ )
	{
		sum += a[i];
	}
	cout<<sum<<endl;
	return 0;
}
0