結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー rf141
提出日時 2015-08-08 01:00:25
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 591 bytes
コンパイル時間 3,532 ms
コンパイル使用メモリ 76,348 KB
実行使用メモリ 56,100 KB
最終ジャッジ日時 2024-10-13 13:33:29
合計ジャッジ時間 10,524 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 4 WA * 39 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class gw{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String str1 = scan.next();
		String str2 = scan.next();
		System.out.println(calc(str1+str2,n));
	}
	public static int calc(String str,int n){
		String[] sp_o = str.split("x",0);//休日
		String[] sp_x = str.split("o",0);
		for(int i = 0; i<sp_x.length;i++){
			if(sp_x[i].length() <= n){
				return sp_x[i].length()+sp_x[i+1].length()+n; 
			}
			if(sp_x[i-1].length() > n && i > 0){
				return sp_o[i].length()+n;
			}
		}

		return 0;
	}
}
0