結果
問題 |
No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
|
ユーザー |
![]() |
提出日時 | 2018-11-04 14:26:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 244 bytes |
コンパイル時間 | 480 ms |
コンパイル使用メモリ | 63,664 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-20 19:56:21 |
合計ジャッジ時間 | 1,685 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 15 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/iostream:39, 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:18:13: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:167:25: warning: 'sum' may be used uninitialized [-Wmaybe-uninitialized] 167 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ main.cpp: In function 'int main()': main.cpp:9:10: note: 'sum' was declared here 9 | long sum; | ^~~
ソースコード
#include <iostream> using namespace std; int main() { int n; int i; int a[500000]; long sum; cin >> n; for (i = 0; i <= n; ++i) { cin >> a[i]; sum += a[i]; } cout << sum << endl; }