結果
問題 | No.436 ccw |
ユーザー | ぴろず |
提出日時 | 2016-10-28 22:25:50 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 600 bytes |
コンパイル時間 | 1,760 ms |
コンパイル使用メモリ | 74,644 KB |
実行使用メモリ | 57,272 KB |
最終ジャッジ日時 | 2024-05-03 07:35:59 |
合計ジャッジ時間 | 5,814 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 120 ms
54,024 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 106 ms
54,052 KB |
testcase_07 | AC | 105 ms
53,840 KB |
testcase_08 | AC | 96 ms
52,892 KB |
testcase_09 | AC | 108 ms
53,944 KB |
testcase_10 | AC | 99 ms
52,700 KB |
testcase_11 | AC | 109 ms
53,932 KB |
testcase_12 | WA | - |
testcase_13 | AC | 98 ms
52,948 KB |
testcase_14 | AC | 95 ms
52,772 KB |
testcase_15 | AC | 106 ms
54,040 KB |
testcase_16 | AC | 119 ms
53,440 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 122 ms
53,424 KB |
testcase_21 | AC | 202 ms
56,932 KB |
testcase_22 | AC | 181 ms
57,024 KB |
testcase_23 | AC | 194 ms
57,272 KB |
testcase_24 | WA | - |
testcase_25 | AC | 195 ms
56,964 KB |
ソースコード
package no436; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for(int i=0;i<s.length()-2;i++) { if (s.substring(i, i+3).equals("ccw")) { min = Math.min(min, i); max = Math.max(max, i); } } if (min == Integer.MAX_VALUE) { System.out.println(0); }else{ // System.out.println(max + 1); // System.out.println(s.length() - min - 2); System.out.println(Math.min(max + 2, s.length() - min - 2)); } } }