結果
| 問題 | No.289 数字を全て足そう |
| コンテスト | |
| ユーザー |
adio_parts
|
| 提出日時 | 2017-06-04 00:50:35 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
WA
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 470 bytes |
| 記録 | |
| コンパイル時間 | 323 ms |
| コンパイル使用メモリ | 79,280 KB |
| 実行使用メモリ | 9,816 KB |
| 最終ジャッジ日時 | 2026-09-02 04:26:54 |
| 合計ジャッジ時間 | 1,916 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 21 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:13: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
20 | ans += list[i];
main.cpp:11:9: note: 'ans' was declared here
11 | int ans;
| ^~~
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <stdexcept>
using namespace std;
int main() {
string s,S;
vector<long> list;
int ans;
cin >> s;
for(long i = 0; i < s.size(); i++){
try {
list.push_back(stoi(s.substr(i,1)));
} catch (const std::invalid_argument& e) {
}
}
for(int i = 0; i < list.size(); i++){
ans += list[i];
}
cout << ans << "\n";
return 0;
}
adio_parts