結果

問題 No.345 最小チワワ問題
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-12 18:16:50
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 564 bytes
コンパイル時間 3,022 ms
コンパイル使用メモリ 72,384 KB
実行使用メモリ 57,940 KB
最終ジャッジ日時 2023-08-17 03:43:59
合計ジャッジ時間 7,814 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,816 KB
testcase_01 AC 118 ms
55,708 KB
testcase_02 AC 119 ms
55,800 KB
testcase_03 AC 120 ms
53,228 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 124 ms
55,600 KB
testcase_08 AC 115 ms
55,864 KB
testcase_09 AC 120 ms
55,260 KB
testcase_10 AC 119 ms
55,812 KB
testcase_11 AC 121 ms
55,732 KB
testcase_12 AC 117 ms
55,772 KB
testcase_13 AC 120 ms
55,840 KB
testcase_14 WA -
testcase_15 AC 119 ms
55,324 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 116 ms
55,496 KB
testcase_20 AC 122 ms
55,884 KB
testcase_21 AC 116 ms
55,636 KB
testcase_22 AC 118 ms
55,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 115 ms
55,736 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 121 ms
55,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int a =S.indexOf("c");
        if(a==-1){
            System.out.println(-1);
        }else{
            S = S.substring(a);
            int b = S.indexOf("w");
            String t = S.substring(b+1);
            int c = t.indexOf("w");
            if(c==-1){
                System.out.println(-1);
            }else{
                System.out.println(b+c+2);
            }
        }
    }
}
0