結果

問題 No.289 数字を全て足そう
ユーザー adio_parts
提出日時 2017-06-04 00:24:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 61,304 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-22 04:40:10
合計ジャッジ時間 1,566 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 1 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <stdexcept>
using namespace std;

int main() {
    
    string s;
    vector<long> list;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        try {
            list.push_back(stoi(s.substr(i,1)));
        } catch (const std::invalid_argument& e) {
        }
    }
    if(list.size() == 0){
        cout << 0 << "\n";
    }else{
        for(int i = 0; i < list.size(); i++){
            cout << list[i];
        }
    }
    cout << "\n";
    
    return 0;
}
0