結果

問題 No.1070 Missing a space
ユーザー suppy193
提出日時 2021-05-01 20:45:06
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 205 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 19,968 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-20 03:58:17
合計ジャッジ時間 643 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%s", s);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void) {

    char s[101];
	int i = 0;
	int count = 0;
	scanf("%s", s);
	while(s[i] != 0){
		if(s[i] != '0'){
			count++;
		}
		i++;
	}
	printf("%d\n", count - 1);

	return 0;
}
0