結果

問題 No.345 最小チワワ問題
ユーザー 1EP4511EP451
提出日時 2016-02-28 21:45:41
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 20,868 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 18:48:53
合計ジャッジ時間 1,064 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,348 KB
testcase_01 AC 0 ms
4,348 KB
testcase_02 AC 0 ms
4,348 KB
testcase_03 AC 0 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 0 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 0 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 0 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 WA -
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 0 ms
4,348 KB
testcase_18 AC 0 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 0 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 WA -
testcase_25 AC 1 ms
4,348 KB
testcase_26 AC 0 ms
4,348 KB
testcase_27 AC 0 ms
4,348 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 WA -
testcase_31 AC 0 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:9: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]
   13 |         gets(s);
      |         ^~~~
      |         fgets
/usr/bin/ld: /tmp/ccWqfDQC.o: in function `main':
main.c:(.text.startup+0x12): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #

#include<stdio.h>

#define N 100
char s[N];
int s_check[N]={0};
int ans=N+1;
int return_flg=0;

int main (void){

	int i,j;

	gets(s);

	for(i=0;i<N;i++){
		if(s[i]=='c') s_check[i]=1;
		else if(s[i]=='w') s_check[i]=2;
	}

	for(i=0;i<N;i++){
		if(s_check[i]==1){
			for(j=i+1;j<N;j++){
				if(s_check[j]==2) return_flg++;

				if(return_flg>1){
					if(ans>(j-i+1)) ans=j-i+1;
					return_flg=0;

					break;	
				}
			}
			
		}
	}
	if(ans==N+1) ans=-1;

	printf("%d",ans);

}
0