結果

問題 No.345 最小チワワ問題
ユーザー marumaru
提出日時 2016-03-24 01:52:20
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 3,759 ms
コンパイル使用メモリ 76,956 KB
実行使用メモリ 57,044 KB
最終ジャッジ日時 2024-04-09 21:15:43
合計ジャッジ時間 8,461 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 144 ms
55,100 KB
testcase_01 AC 146 ms
54,884 KB
testcase_02 AC 148 ms
54,972 KB
testcase_03 AC 135 ms
55,336 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 114 ms
54,148 KB
testcase_08 AC 113 ms
53,904 KB
testcase_09 AC 114 ms
53,848 KB
testcase_10 AC 146 ms
55,140 KB
testcase_11 AC 116 ms
54,200 KB
testcase_12 AC 118 ms
54,224 KB
testcase_13 AC 117 ms
54,256 KB
testcase_14 WA -
testcase_15 AC 147 ms
54,912 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 144 ms
54,792 KB
testcase_20 AC 131 ms
55,036 KB
testcase_21 AC 103 ms
53,480 KB
testcase_22 AC 149 ms
54,940 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 108 ms
54,188 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 116 ms
54,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class yukicoder_345 {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String str1 = stdIn.next();
		
		int mojisu = -1;
		
		int c = str1.indexOf("c");
		
		if (c != -1) {
			String str2 = str1.substring(c + 1);
			int w1 = str2.indexOf("w");
			
			if (w1 != -1) {
				String str3 = str2.substring(w1 + 1);
				
				int w2 = str3.indexOf("w");
				
				if(w2 != -1) {
					String moji = str1.substring(c, c + 1) + str2.substring(0, w1 + 1) + str3.substring(0, w2 + 1);
					mojisu = moji.length();				}
			}
		}
		System.out.println(mojisu);
	}
}
0