結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
t8m8⛄️
|
| 提出日時 | 2015-05-22 01:23:29 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,376 bytes |
| コンパイル時間 | 3,731 ms |
| コンパイル使用メモリ | 80,240 KB |
| 実行使用メモリ | 56,192 KB |
| 最終ジャッジ日時 | 2024-10-13 13:19:35 |
| 合計ジャッジ時間 | 12,244 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 25 |
ソースコード
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class No0204 {
static final Scanner in = new Scanner(System.in);
static final PrintWriter out = new PrintWriter(System.out,false);
static void solve() {
int d = in.nextInt();
String s = in.next();
String t = in.next();
s += t;
char[] cs = s.toCharArray();
int res = 0;
for (int i=0; i<14; i++) {
char[] clone = cs.clone();
for (int j=i; j-i<d && j<14; j++) {
clone[j] = 'o';
}
res = max(res,count(clone));
}
out.println(res);
}
static int count(char[] cs) {
int res = 0;
for (int i=1; i<14; i++) {
if (cs[i] == 'x') continue;
int cnt = 1;
while (i < 14 && cs[i] == cs[i-1]) {
cnt++;
i++;
}
res = max(res,cnt);
}
return res;
}
public static void main(String[] args) {
long start = System.currentTimeMillis();
solve();
out.flush();
long end = System.currentTimeMillis();
//trace(end-start + "ms");
in.close();
out.close();
}
static void trace(Object... o) { System.out.println(deepToString(o));}
}
t8m8⛄️