結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
|
提出日時 | 2016-09-07 10:11:40 |
言語 | PHP (843.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 538 bytes |
コンパイル時間 | 1,436 ms |
コンパイル使用メモリ | 31,076 KB |
実行使用メモリ | 31,976 KB |
最終ジャッジ日時 | 2024-11-15 21:02:45 |
合計ジャッジ時間 | 5,035 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 5 WA * 41 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php $days = trim(fgets(STDIN)); $str = trim(fgets(STDIN)); $str .= trim(fgets(STDIN)); $max = getmax($str); for($i = 0; $i < 14; $i++) { $tempStr = $str; $j = 0; while(($tempStr[$i + $j] == "x") && ($j < $days)) { echo "$i \n"; $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; }