結果
| 問題 |
No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用)
|
| ユーザー |
YT31524894
|
| 提出日時 | 2017-06-12 21:56:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 273 bytes |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 22,784 KB |
| 実行使用メモリ | 40,704 KB |
| 最終ジャッジ日時 | 2024-12-25 16:09:58 |
| 合計ジャッジ時間 | 2,140 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 15 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%lld",&a[i]);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:13:20: warning: ‘sum’ may be used uninitialized in this function [-Wmaybe-uninitialized]
13 | sum+=a[i];
| ~~~^~~~~~
ソースコード
#include <cstdio>
using namespace std;
int main(){
int N=2;
scanf("%d",&N);
long long int a[5000001];
long long int sum;
for(int i=0;i<N;i++){
scanf("%lld",&a[i]);
}
for(int i=0; i<N; i++){
sum+=a[i];
}
printf("%lld\n",sum);
return 0;
}
YT31524894