結果

問題 No.289 数字を全て足そう
ユーザー oooooba
提出日時 2021-01-08 22:49:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 362 bytes
コンパイル時間 555 ms
コンパイル使用メモリ 75,348 KB
最終ジャッジ日時 2025-01-17 13:25:17
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <optional>
#include <vector>

using namespace std;

int main() {
    string s;
    cin >> s;
    int32_t sum = 0;
    for (auto c : s) {
        if ('0' <= c && c <= '9') {
            sum += c - '0';
        }
    }
    cout << sum << endl;
    return 0;
}
0