結果

問題 No.9011 数字を全て足そう(数字だけ)
ユーザー hotaru
提出日時 2020-05-29 20:12:16
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 1,138 ms
コンパイル使用メモリ 84,188 KB
最終ジャッジ日時 2025-01-10 16:19:02
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

constexpr int ctoi(int c) { return '0' <= c && c <= '9' ? c - '0' : -1; }

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    string s;
    cin >> s;

    int ans = 0;
    for (auto &&i : s) {
        ans += ctoi(i);
    }

    cout << ans << "\n";
}
0