結果

問題 No.289 数字を全て足そう
ユーザー kichirb3
提出日時 2018-02-27 19:56:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 387 bytes
コンパイル時間 605 ms
コンパイル使用メモリ 65,372 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 01:09:40
合計ジャッジ時間 1,609 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.289 数字を全て足そう
// https://yukicoder.me/problems/no/289
//

using namespace std;
#include <iostream>

int solve(string &S);

int main() {
    string S;
    cin >> S;

    int ans = solve(S);
    cout << ans << endl;
}

int solve(string &S) {
    int ans = 0;
    for (char c: S) {
        if (isdigit(c)) {
            ans += c - '0';
        }
    }
    return ans;
}
0