結果

問題 No.289 数字を全て足そう
ユーザー mannshi222
提出日時 2022-03-22 23:42:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 29 ms / 1,000 ms
コード長 254 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 67,808 KB
最終ジャッジ日時 2025-01-28 11:02:52
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cctype>

using namespace std;

int main()
{
	string S;
	cin >> S;
	int sum = 0;
	int i = 0;
	for( i = 0; i < S.size(); i++ ) {
		if( isdigit( S.at(i) ) ) {
			sum +=  S.at(i) - '0';
		}
	}
	cout << sum << endl;
	return 0;
}
0