結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー rf141rf141
提出日時 2015-08-08 01:00:25
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 591 bytes
コンパイル時間 3,169 ms
コンパイル使用メモリ 77,096 KB
実行使用メモリ 41,672 KB
最終ジャッジ日時 2024-04-21 14:47:02
合計ジャッジ時間 9,951 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 115 ms
41,220 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 115 ms
41,292 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 120 ms
41,236 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 116 ms
41,364 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 RE -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 RE -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 RE -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
権限があれば一括ダウンロードができます

ソースコード

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