結果

問題 No.289 数字を全て足そう
ユーザー ningenMe
提出日時 2017-08-10 00:30:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 449 bytes
コンパイル時間 635 ms
コンパイル使用メモリ 70,688 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 00:30:05
合計ジャッジ時間 1,467 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cctype>
using namespace std;

int main() {
	int i;
	string S,SS;
	cin >> S;
	vector<int> a;
	for ( i = 0; i < S.length(); i++) {
		if (isdigit(S[i]) != 0) { 
			SS = S[i];
			a.push_back(stoi(SS)); };
	}
	cout << accumulate(a.begin(), a.end(), 0) << endl;
	return 0;
}
0