結果

問題 No.436 ccw
ユーザー zuvizudarzuvizudar
提出日時 2017-01-02 00:31:57
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 224 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-16 06:06:46
合計ジャッジ時間 1,685 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:11: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
    6 |         j=strlen(S);
      |           ^~~~~~
main.c:2:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
    1 | #include<stdio.h>
  +++ |+#include <string.h>
    2 | int main(){
main.c:6:11: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
    6 |         j=strlen(S);
      |           ^~~~~~
main.c:6:11: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
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];
	int c=0,w=0,i,j;
	scanf("%s",S);
	j=strlen(S);
	for(i=0;i<j;i++){
		if(S[i]=='c')
			c++;
		else
			w++;
	}
	if(c-1>w)
		printf("%d",w);
	else
		printf("%d",c-1);

	return 0;
}
0