結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー spacia
提出日時 2016-01-18 23:59:29
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 894 bytes
コンパイル時間 2,189 ms
コンパイル使用メモリ 78,028 KB
実行使用メモリ 37,416 KB
最終ジャッジ日時 2024-10-13 13:51:52
合計ジャッジ時間 6,147 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.math.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static int solve (String s , int n) {
		int ret = 0;
		int len = s.length();
		for (int i = 0; i < len; i++) {
			int cnt = 0 , j = i;
			char[] c = s.toCharArray();
			while (j < len && cnt < n && c[j] == 'x') {
				cnt++;
				c[j++] = 'o';
			}
			//out(Arrays.toString(c));
			j = 0;
			cnt = 0;
			while (j < len) {
				while (j < len && c[j] == 'o') {
					cnt++;
					j++;
				}
				j++;
				ret = Math.max(ret , cnt);
				cnt = 0;
			}
		}
		return ret;
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		String w1 = br.readLine();
		String w2 = br.readLine();
		out(solve(w1 + w2 , n));
	}
	
}
0