結果

問題 No.289 数字を全て足そう
ユーザー Kato Shinya
提出日時 2017-04-01 23:17:54
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 267 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 28,544 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 19:16:42
合計ジャッジ時間 1,329 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <ctype.h>

int main(void)
{
  char nums[100001];
  int result = 0;

  scanf("%s", nums);
  for (int i = 0; nums[i] != '\0'; ++i) {
    if (isdigit(nums[i])) {
      result += nums[i] - '0';
    }
  }
  printf("%d\n", result);
  return 0;
}
0