結果

問題 No.345 最小チワワ問題
ユーザー zect518
提出日時 2018-05-27 14:40:11
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 381 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 28,288 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-28 18:28:49
合計ジャッジ時間 987 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int moji(char *A){//
	int i=0,s,count,min=101;
	while(A[s] != '\0'){
		count=0;
		if(A[s]=='c'){i=s;
		while(A[i]!='\0'){
			if(A[i]=='w')count++;
			if(count==2){
				if(min>(i-s+1))min=i-s+1;
				break;}
			i++;
		}
		}s++;
	}
	if(min!=101)return min;
	else return -1;
}
int main(){
	char textA[100000]="";
	scanf("%s",textA);
	printf("\n%d",moji(textA));

}
0