結果

問題 No.289 数字を全て足そう
ユーザー SiLeader
提出日時 2018-06-14 20:58:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 326 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 60,444 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 14:29:06
合計ジャッジ時間 1,158 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>

int main() {
    std::string s;
    std::cin>>s;

    s.erase(std::remove_if(std::begin(s), std::end(s), [](char c)->bool {return !std::isdigit(c);}), std::end(s));
    
    int n=0;
    for(char c : s) {
        n += (c - '0');
    }
    std::cout<<n<<std::endl;
}
0