結果
| 問題 |
No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用)
|
| ユーザー |
ロク@マジミラ2023(幕張)9/1~9/3参加
|
| 提出日時 | 2023-08-03 01:14:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 531 bytes |
| コンパイル時間 | 1,633 ms |
| コンパイル使用メモリ | 165,380 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 23:22:09 |
| 合計ジャッジ時間 | 3,406 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 15 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:39,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54,
from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:28:13:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'sum' may be used uninitialized [-Wmaybe-uninitialized]
202 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:20:18: note: 'sum' was declared here
20 | long long n, sum, tmp;
| ^~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int ctoi(char &c){
switch(c){
case '1': return 1;
case '2': return 2;
case '3': return 3;
case '4': return 4;
case '5': return 5;
case '6': return 6;
case '7': return 7;
case '8': return 8;
case '9': return 9;
default: return 0;
}
}
int main() {
long long n, sum, tmp;
cin >> n;
for(int i = 0; i < n; i++) {
cin >> tmp;
sum += tmp;
}
cout << sum << endl;
}
ロク@マジミラ2023(幕張)9/1~9/3参加