結果

問題 No.345 最小チワワ問題
ユーザー fal_rndfal_rnd
提出日時 2017-06-27 20:19:21
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 294 bytes
コンパイル時間 2,386 ms
コンパイル使用メモリ 74,172 KB
実行使用メモリ 54,780 KB
最終ジャッジ日時 2024-04-15 03:30:59
合計ジャッジ時間 6,851 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
54,176 KB
testcase_01 AC 119 ms
54,144 KB
testcase_02 AC 120 ms
54,260 KB
testcase_03 AC 119 ms
54,032 KB
testcase_04 AC 119 ms
53,960 KB
testcase_05 WA -
testcase_06 AC 119 ms
54,120 KB
testcase_07 AC 106 ms
53,016 KB
testcase_08 AC 105 ms
53,036 KB
testcase_09 AC 120 ms
54,060 KB
testcase_10 AC 119 ms
54,192 KB
testcase_11 AC 118 ms
53,992 KB
testcase_12 AC 120 ms
54,036 KB
testcase_13 AC 122 ms
54,000 KB
testcase_14 AC 109 ms
53,100 KB
testcase_15 AC 121 ms
54,120 KB
testcase_16 AC 120 ms
54,232 KB
testcase_17 AC 120 ms
53,996 KB
testcase_18 WA -
testcase_19 AC 121 ms
54,144 KB
testcase_20 AC 117 ms
54,104 KB
testcase_21 AC 135 ms
54,140 KB
testcase_22 AC 135 ms
53,956 KB
testcase_23 AC 117 ms
54,284 KB
testcase_24 AC 117 ms
53,896 KB
testcase_25 AC 119 ms
53,812 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 114 ms
54,040 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 116 ms
54,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class A{
	public static void main(String[]$){
		char[]v=new java.util.Scanner(System.in).next().toCharArray();
		for(int i=0,c=-1,w=0;i<v.length;i++){
			if(w==0&&v[i]=='c')c=i;
			if(c>=0&&v[i]=='w'&&++w==2) {
				System.out.println(i-c+1);
				return;
			}
		}
		System.out.println(-1);
	}
}
0