結果
| 問題 | No.204 ゴールデン・ウィーク(2) |
| コンテスト | |
| ユーザー |
jp_ste
|
| 提出日時 | 2019-08-05 05:41:22 |
| 言語 | JavaScript (node v25.8.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,021 bytes |
| 記録 | |
| コンパイル時間 | 91 ms |
| コンパイル使用メモリ | 6,656 KB |
| 実行使用メモリ | 52,608 KB |
| 最終ジャッジ日時 | 2026-04-30 06:38:59 |
| 合計ジャッジ時間 | 7,343 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 46 |
ソースコード
function Main(input) {
const data = input.split("\n");
const d = Number(data[0]);
const c = data[1] + data[2];
let realD = d;
let realC = 'x'.repeat(d) + c + 'x'.repeat(d);
console.log(realC)
let max = 0;
for(let j=0; j<d; j++) {
for(let i=0; i<realC.length; i++) {
if(haveLengthX(realC, i, realD)) {
let len = countBeforA(realC, i-1) + realD + countAfterA(realC, i+realD);
max = Math.max(max, len);
}
}
realD--;
}
console.log(max);
}
function haveLengthX(list, start, length) {
for(let i=start; i<start+length; i++) {
if(list[i] == 'o') return false;
}
return true;
}
function countAfterA(list, start) {
let count = 0;
for(let i=start; i<list.length; i++) {
if(list[i] == 'x') return count;
count++;
}
return count;
}
function countBeforA(list, start) {
let count = 0;
for(let i=start; i>=0; i--) {
if(list[i] == 'x') return count;
count++;
}
return count;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
jp_ste