結果

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

ソースコード

diff #

#include<iostream>
#include<string>

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(std::invalid_argument e){
	}
    }
    cout << outputNumber << endl;
    return 0;
}
0