結果

問題 No.289 数字を全て足そう
ユーザー dododondon111
提出日時 2017-03-17 16:04:10
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 227 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 29,184 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-04 13:42:03
合計ジャッジ時間 1,337 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:10:3: warning: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   10 |   gets(s);
      |   ^~~~
      |   fgets
/usr/bin/ld: /tmp/cctsuc0p.o: in function `main':
main.c:(.text.startup+0xe): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #

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

int main(){
  int i;
  int total=0;
  char s[10000];

  gets(s);

  for(i=0;s[i];i++){
    if(isdigit(s[i])) total += s[i]-'0';
  }

  printf("%d\n",total);

  return 0;
}
0