結果

問題 No.345 最小チワワ問題
コンテスト
ユーザー zect518
提出日時 2018-05-27 14:40:11
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 381 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 149 ms
コンパイル使用メモリ 36,576 KB
最終ジャッジ日時 2026-02-22 01:09:31
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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