結果

問題 No.289 数字を全て足そう
ユーザー KotRm
提出日時 2019-03-15 12:34:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 480 bytes
コンパイル時間 455 ms
コンパイル使用メモリ 56,536 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 18:23:22
合計ジャッジ時間 1,235 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cctype>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define print(x) cout << x << endl;
using namespace std;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string str;
    cin >> str;
    int ans = 0;
    string c;
    REP(i, str.size()){
        if (isalpha(str[i])){
            continue;
        }else{
            c = str.substr(i,1);
            ans += stoi(c);
        }
    }
    print(ans);
    return 0;
}
0