結果

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

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<sstream>
#include<cctype>
#include<functional>
using namespace std;

int main()
{
	int a, sum = 0;
	string s;
	stringstream ss;
	cin >> s;
	for (int i = 0; i < static_cast<int>(s.size()); i++)
	{
		if (isdigit(s[i]))
		{
			ss << s[i]; ss >> a; ss.clear();
			sum += a;
		}
	}
	cout << sum << endl;
	return 0;
}
0