結果

問題 No.289 数字を全て足そう
ユーザー waywaywaiwai
提出日時 2017-07-21 21:28:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 23 ms / 1,000 ms
コード長 343 bytes
コンパイル時間 523 ms
コンパイル使用メモリ 55,932 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 03:41:19
合計ジャッジ時間 1,666 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<stdexcept>

using namespace std;

int main(){
    string input;
    int outputNumber = 0,i,j;
    cin >> input;
    for(i=0;i<input.size();i++){
	try{
	    j = stoi(input.substr(i,1));
	    outputNumber += j;
	}
	catch(invalid_argument e){
	}
    }
    cout << outputNumber << endl;
    return 0;
}
0