結果

問題 No.9011 数字を全て足そう(数字だけ)
ユーザー ngng628
提出日時 2020-10-31 22:33:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 1,792 ms
コンパイル使用メモリ 167,836 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-22 05:26:42
合計ジャッジ時間 2,404 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

# include <bits/stdc++.h>
using namespace std;
constexpr int ctoi(const char c) { return ('0' <= c && c <= '9') ? (c - '0') : -1; }
int main() {
    string s;
    cin >> s;
    int sum = 0;
    for (auto& c : s) {
        sum += ctoi(c);
    }
    cout << sum << endl;
}
0