結果

問題 No.9011 数字を全て足そう(数字だけ)
ユーザー tagufartv
提出日時 2020-09-28 22:19:57
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 214 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 29,056 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-02 17:26:09
合計ジャッジ時間 1,353 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:7:11: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    7 |     int l=strlen(s);
      |           ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strlen'
    2 | #include<stdlib.h>
  +++ |+#include <string.h>
    3 | 
main.c:7:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    7 |     int l=strlen(s);
      |           ^~~~~~
main.c:7:11: note: include '<string.h>' or provide a declaration of 'strlen'

ソースコード

diff #

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

int main(void){
    char s[101];
    scanf("%s",s);
    int l=strlen(s);
    int c=0;
    for(int i=0;i<l;i++){
        c+=s[i]-'0';
    }
    printf("%d\n",c);
    return 0;
}
0