結果

問題 No.436 ccw
ユーザー ぴろずぴろず
提出日時 2016-10-28 22:26:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 1,904 ms
コンパイル使用メモリ 71,912 KB
実行使用メモリ 59,392 KB
最終ジャッジ日時 2023-08-15 21:02:05
合計ジャッジ時間 6,900 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,348 KB
testcase_01 AC 120 ms
55,788 KB
testcase_02 AC 122 ms
55,820 KB
testcase_03 AC 120 ms
55,936 KB
testcase_04 AC 119 ms
55,780 KB
testcase_05 AC 119 ms
55,868 KB
testcase_06 AC 119 ms
55,564 KB
testcase_07 AC 120 ms
55,784 KB
testcase_08 AC 121 ms
55,600 KB
testcase_09 AC 121 ms
55,636 KB
testcase_10 AC 120 ms
55,740 KB
testcase_11 AC 120 ms
55,784 KB
testcase_12 AC 120 ms
55,804 KB
testcase_13 AC 119 ms
55,376 KB
testcase_14 AC 120 ms
55,744 KB
testcase_15 AC 121 ms
55,632 KB
testcase_16 AC 150 ms
55,628 KB
testcase_17 AC 129 ms
55,776 KB
testcase_18 AC 150 ms
55,908 KB
testcase_19 AC 144 ms
55,688 KB
testcase_20 AC 146 ms
56,048 KB
testcase_21 AC 238 ms
59,392 KB
testcase_22 AC 222 ms
59,024 KB
testcase_23 AC 224 ms
59,028 KB
testcase_24 AC 208 ms
59,012 KB
testcase_25 AC 218 ms
58,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 + 1, s.length() - min - 2));
		}
	}

}
0