結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー thorikawa
提出日時 2015-05-08 23:13:26
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,014 bytes
コンパイル時間 2,511 ms
コンパイル使用メモリ 81,824 KB
実行使用メモリ 56,436 KB
最終ジャッジ日時 2024-10-13 11:49:47
合計ジャッジ時間 11,594 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 20 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] argv) {
        Scanner scanner = new Scanner(System.in);
        int d = scanner.nextInt();
        String s = scanner.next();
        s += scanner.next();
        s = "xxxxxxx" + s + "xxxxxxx";
        int res = 0;
        for (int i = 0; i < 28; ++i) {
            int len = 0;
            for (int j = 0; j < d && j < 14 - i; ++j) {
                if (s.charAt(i + j) == 'o') {
                    break;
                }
                len++;
            }
            int count = 0;
            for (int j = 0; j < 28; ++j) {
                boolean isYukyu = (j >= i) && ((j - i) < len);
//                boolean isYukyu = (j >= i) && ((j - i) < d);
                if (s.charAt(j) == 'o' || isYukyu) {
                    count++;
                    res = Math.max(res, count);
                } else {
                    count = 0;
                }
            }
        }
        System.out.println(res);
    }
}
0