結果

問題 No.345 最小チワワ問題
ユーザー TatsuDXTatsuDX
提出日時 2016-09-03 14:49:58
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 3,054 ms
コンパイル使用メモリ 74,216 KB
実行使用メモリ 54,332 KB
最終ジャッジ日時 2024-04-27 15:20:58
合計ジャッジ時間 7,323 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
54,100 KB
testcase_01 AC 98 ms
52,908 KB
testcase_02 AC 115 ms
54,200 KB
testcase_03 AC 111 ms
53,916 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 107 ms
53,864 KB
testcase_08 AC 107 ms
53,688 KB
testcase_09 AC 108 ms
54,008 KB
testcase_10 AC 96 ms
52,852 KB
testcase_11 AC 95 ms
52,636 KB
testcase_12 AC 107 ms
53,728 KB
testcase_13 AC 97 ms
52,852 KB
testcase_14 WA -
testcase_15 AC 112 ms
54,068 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 103 ms
53,384 KB
testcase_20 AC 101 ms
54,332 KB
testcase_21 AC 103 ms
52,904 KB
testcase_22 AC 101 ms
53,156 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 104 ms
54,072 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 105 ms
53,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		int a, b, c;
		a = s.indexOf("c");
		if (a < 0) {
			System.out.println(-1);
			return;
		}
		b = s.indexOf("w", a + 1);
		if (b < 0) {
			System.out.println(-1);
			return;
		}
		c = s.indexOf("w", b + 1);
		if (c < 0) {
			System.out.println(-1);
			return;
		}
		System.out.println(c - a + 1);
	}
}
0