結果
| 問題 |
No.436 ccw
|
| コンテスト | |
| ユーザー |
ぴろず
|
| 提出日時 | 2016-10-28 22:25:50 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 600 bytes |
| コンパイル時間 | 2,101 ms |
| コンパイル使用メモリ | 74,504 KB |
| 実行使用メモリ | 45,928 KB |
| 最終ジャッジ日時 | 2024-11-24 05:43:11 |
| 合計ジャッジ時間 | 6,462 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 15 WA * 9 |
ソースコード
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));
}
}
}
ぴろず