結果

問題 No.345 最小チワワ問題
ユーザー HaijinnHaijinn
提出日時 2018-02-22 16:47:38
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 396 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 21,632 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-09 20:33:42
合計ジャッジ時間 1,157 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,812 KB
testcase_01 AC 0 ms
6,812 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 0 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
6,940 KB
testcase_11 WA -
testcase_12 AC 0 ms
6,940 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 0 ms
6,948 KB
testcase_19 WA -
testcase_20 AC 0 ms
6,940 KB
testcase_21 AC 1 ms
6,940 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 0 ms
6,944 KB
testcase_29 AC 0 ms
6,944 KB
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 | scanf("%s",s);
      | ^~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
char s[101];
int i;
int x=0;
int z=0;
int t=0;
scanf("%s",s);

for(i=0;i<strlen(s);i++){
	if(s[i]=='c'){
		if(t<=i){
		t=i;
		}
	}
}
for(i=0;i<strlen(s);i++){
	if(s[i]=='w'){
		if(z<=i&&t<i){
		z=i;
		x++;
		if(x==2){
			break;
			
		}
		}
	}
}
if(z-t+1>0){
printf("%d\n",z-t+1);
}else{
	printf("-1\n");
	
}
	return 0;
}
0