結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー papinianus
提出日時 2016-09-07 10:18:01
言語 PHP
(843.2)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 1,523 ms
コンパイル使用メモリ 32,400 KB
実行使用メモリ 32,912 KB
最終ジャッジ日時 2024-11-15 21:02:56
合計ジャッジ時間 4,866 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 WA * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$days = trim(fgets(STDIN));
$str = "xxxxxxxxxxxxxx";
$str .= trim(fgets(STDIN));
$str .= trim(fgets(STDIN));
$str .= "xxxxxxxxxxxxxx";
$max = getmax($str);
for($i = 14; $i < 28; $i++) {
    $tempStr = $str;
    $j = 0;
    if($tempStr[$i] == "x") {
        while($j < $days) {
            $tempStr[$i+$j] = "o";
            $j++;
        }
        $max = max($max, getmax($tempStr));
    }
}
echo $max;

function getmax($str) {
    $max = 0;
    preg_match_all('/o+/',$str,$matches);
    foreach($matches[0] as $match) {
        $max = max($max, strlen($match));
    }
    return $max;
}
0