結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  string s;
  cin >> s;
  
  int ans = 0, l = s.size();
  for(int i = 0; i < l; i++){
    int n = s.at(i) - '0';
    if(n < 0 || n > 9) continue;
    ans += n;
  }
  
  cout << ans << endl;
}
0