結果

問題 No.345 最小チワワ問題
ユーザー chiyodachiyoda
提出日時 2016-06-21 01:30:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 437 bytes
コンパイル時間 2,332 ms
コンパイル使用メモリ 73,912 KB
実行使用メモリ 41,780 KB
最終ジャッジ日時 2024-04-19 23:32:40
合計ジャッジ時間 7,200 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
41,088 KB
testcase_01 AC 128 ms
41,236 KB
testcase_02 AC 125 ms
41,088 KB
testcase_03 AC 121 ms
41,084 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 124 ms
41,104 KB
testcase_08 AC 128 ms
40,964 KB
testcase_09 AC 129 ms
41,368 KB
testcase_10 AC 127 ms
41,328 KB
testcase_11 AC 127 ms
41,320 KB
testcase_12 AC 130 ms
41,196 KB
testcase_13 AC 131 ms
41,424 KB
testcase_14 WA -
testcase_15 AC 132 ms
41,776 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 130 ms
41,244 KB
testcase_20 AC 127 ms
41,196 KB
testcase_21 AC 112 ms
41,096 KB
testcase_22 AC 129 ms
41,400 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 128 ms
41,496 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 129 ms
41,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int c = S.indexOf("c");
    if (c >= 0) {
      int w1 = S.indexOf("w", c + 1);
      if (w1 >= 0) {
        int w2 = S.indexOf("w", w1 + 1);
        if (w2 >= 0) {
          System.out.println(w2 - c +1);
          return;
        }
      }
    } 

    System.out.println(-1);
  }
}
0