結果
| 問題 | No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用) |
| ユーザー |
|
| 提出日時 | 2019-05-21 07:36:24 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 348 bytes |
| 記録 | |
| コンパイル時間 | 399 ms |
| コンパイル使用メモリ | 76,836 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-04-06 04:59:42 |
| 合計ジャッジ時間 | 1,775 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 15 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:24:10:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:175:25: warning: 'sum' may be used uninitialized [-Wmaybe-uninitialized]
175 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:8:14: note: 'sum' was declared here
8 | long sum;
| ^~~
ソースコード
#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;
}