結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー | kou6839 |
提出日時 | 2015-05-09 14:56:50 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 140 ms / 1,000 ms |
コード長 | 1,067 bytes |
コンパイル時間 | 2,431 ms |
コンパイル使用メモリ | 76,416 KB |
実行使用メモリ | 56,232 KB |
最終ジャッジ日時 | 2023-08-25 23:40:40 |
合計ジャッジ時間 | 11,017 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 135 ms
55,796 KB |
testcase_01 | AC | 140 ms
55,944 KB |
testcase_02 | AC | 137 ms
55,716 KB |
testcase_03 | AC | 136 ms
55,840 KB |
testcase_04 | AC | 134 ms
56,064 KB |
testcase_05 | AC | 135 ms
56,080 KB |
testcase_06 | AC | 132 ms
55,968 KB |
testcase_07 | AC | 137 ms
55,876 KB |
testcase_08 | AC | 138 ms
55,776 KB |
testcase_09 | AC | 136 ms
55,584 KB |
testcase_10 | AC | 136 ms
55,840 KB |
testcase_11 | AC | 134 ms
55,832 KB |
testcase_12 | AC | 135 ms
55,748 KB |
testcase_13 | AC | 138 ms
55,588 KB |
testcase_14 | AC | 135 ms
56,232 KB |
testcase_15 | AC | 136 ms
55,800 KB |
testcase_16 | AC | 135 ms
55,956 KB |
testcase_17 | AC | 136 ms
55,688 KB |
testcase_18 | AC | 137 ms
56,000 KB |
testcase_19 | AC | 137 ms
55,992 KB |
testcase_20 | AC | 138 ms
55,628 KB |
testcase_21 | AC | 140 ms
55,924 KB |
testcase_22 | AC | 137 ms
55,964 KB |
testcase_23 | AC | 135 ms
55,576 KB |
testcase_24 | AC | 136 ms
56,004 KB |
testcase_25 | AC | 136 ms
55,712 KB |
testcase_26 | AC | 132 ms
55,800 KB |
testcase_27 | AC | 136 ms
56,148 KB |
testcase_28 | AC | 138 ms
55,824 KB |
testcase_29 | AC | 135 ms
55,744 KB |
testcase_30 | AC | 135 ms
55,952 KB |
testcase_31 | AC | 134 ms
55,908 KB |
testcase_32 | AC | 135 ms
55,768 KB |
testcase_33 | AC | 136 ms
53,712 KB |
testcase_34 | AC | 130 ms
55,400 KB |
testcase_35 | AC | 132 ms
55,928 KB |
testcase_36 | AC | 131 ms
55,820 KB |
testcase_37 | AC | 136 ms
55,820 KB |
testcase_38 | AC | 136 ms
55,772 KB |
testcase_39 | AC | 133 ms
55,880 KB |
testcase_40 | AC | 132 ms
55,788 KB |
testcase_41 | AC | 134 ms
55,704 KB |
testcase_42 | AC | 135 ms
55,668 KB |
testcase_43 | AC | 131 ms
56,020 KB |
testcase_44 | AC | 131 ms
55,896 KB |
testcase_45 | AC | 135 ms
55,772 KB |
testcase_46 | AC | 136 ms
56,080 KB |
testcase_47 | AC | 135 ms
55,908 KB |
testcase_48 | AC | 134 ms
55,884 KB |
ソースコード
import java.io.File; import java.util.*; public class Main { static int cul(String a){ int ans=0; for(int i=0;i<a.length();i++){ if(a.charAt(i)=='o'){ int temp=1; int j=1; while(i+j<a.length() && a.charAt(i+j)=='o'){ j++; temp++; } ans=Math.max(ans, temp); i+=j; } } return ans; } public static void main(String[] args){ // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String a = sc.next(); String b = sc.next(); a+=b; int ans=0; String aa ="xxxxxxxxxxxxxxxxxxxxxxxx"; aa+=a; aa+="xxxxxxxxxxxxxxxxxxxx"; for(int k=0;k<=n;k++){ String rep =""; for(int w=0;w<k;w++) rep+="o"; //System.out.println(rep); int i=0; tt:while(i+k-1<aa.length()){ for(int j=i;j<i+k;j++){ if(aa.charAt(j)=='o'){ i++; continue tt; } } StringBuilder c = new StringBuilder(aa); c.replace(i, i+k,rep); //System.out.println(c); ans=Math.max(ans, cul(c.toString())); i++; } } System.out.println(ans); } }