結果

問題 No.436 ccw
ユーザー tj_0612
提出日時 2016-11-18 01:05:18
言語 C90
(gcc 12.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 302 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 20,352 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-26 03:29:12
合計ジャッジ時間 920 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 7 WA * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%s",S);
      |         ^~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	char S[100001];
	scanf("%s",S);

	int count_c,count_w;
	int i = 0;
	while(1){
		if(S[i]=='\0')
			break;
		else if(S[i]=='c')
			count_c++;
		else
			count_w++;
		i++;
	}
	if(count_w >= count_c)
		printf("%d\n", count_c-1);
	else
		printf("%d\n", count_w);
	return 0;
}
0