結果

問題 No.289 数字を全て足そう
ユーザー つなぎ
提出日時 2017-02-20 15:58:20
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 244 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 21,632 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 06:18:58
合計ジャッジ時間 1,329 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[10000]’ [-Wformat=]
    8 |   scanf("%s",&aa);
      |          ~^  ~~~
      |           |  |
      |           |  char (*)[10000]
      |           char *
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%s",&aa);
      |   ^~~~~~~~~~~~~~~

ソースコード

diff #

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

int main(void) {
  char aa[10000]={0};
  int i,count=0;
  scanf("%s",&aa);

  for(i=0;i<strlen(aa);i++){
    if(isdigit(aa[i]))count+=aa[i]-'0';
  }
   printf("%d",count);
  return 0;
}
0