結果
問題 |
No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用)
|
ユーザー |
|
提出日時 | 2019-05-21 07:36:24 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 348 bytes |
コンパイル時間 | 469 ms |
コンパイル使用メモリ | 59,832 KB |
実行使用メモリ | 7,164 KB |
最終ジャッジ日時 | 2024-09-17 08:43:20 |
合計ジャッジ時間 | 2,353 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 15 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:21:21: warning: ‘sum’ may be used uninitialized in this function [-Wmaybe-uninitialized] 21 | sum += number[i];
ソースコード
#include <iostream> #include <vector> using namespace std; int main() { long input; vector<long> number; long sum; cin >> input; cout << endl; number.resize(input); for (size_t i = 0; i < input; i++) { cin >> number[i]; }; cout << endl; for (size_t i = 0; i < number.size(); i++) { sum += number[i]; }; cout << sum << endl; }