結果

問題 No.203 ゴールデン・ウィーク(1)
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-14 18:42:34
言語 PHP
(8.3.4)
結果
AC  
実行時間 42 ms / 1,000 ms
コード長 605 bytes
コンパイル時間 2,058 ms
コンパイル使用メモリ 30,380 KB
実行使用メモリ 30,980 KB
最終ジャッジ日時 2024-04-29 08:24:10
合計ジャッジ時間 4,171 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
30,616 KB
testcase_01 AC 40 ms
30,760 KB
testcase_02 AC 41 ms
30,832 KB
testcase_03 AC 40 ms
30,948 KB
testcase_04 AC 41 ms
30,748 KB
testcase_05 AC 40 ms
30,980 KB
testcase_06 AC 40 ms
30,832 KB
testcase_07 AC 40 ms
30,732 KB
testcase_08 AC 42 ms
30,548 KB
testcase_09 AC 41 ms
30,576 KB
testcase_10 AC 41 ms
30,712 KB
testcase_11 AC 40 ms
30,608 KB
testcase_12 AC 41 ms
30,688 KB
testcase_13 AC 41 ms
30,884 KB
testcase_14 AC 41 ms
30,776 KB
testcase_15 AC 41 ms
30,496 KB
testcase_16 AC 41 ms
30,632 KB
testcase_17 AC 41 ms
30,688 KB
testcase_18 AC 40 ms
30,528 KB
testcase_19 AC 40 ms
30,860 KB
testcase_20 AC 41 ms
30,768 KB
testcase_21 AC 41 ms
30,784 KB
testcase_22 AC 40 ms
30,620 KB
testcase_23 AC 40 ms
30,784 KB
testcase_24 AC 40 ms
30,540 KB
testcase_25 AC 40 ms
30,676 KB
testcase_26 AC 40 ms
30,936 KB
testcase_27 AC 41 ms
30,900 KB
testcase_28 AC 40 ms
30,732 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$week1 = trim(fgets(STDIN));
$week2 = trim(fgets(STDIN));
$day = array();
for($i = 0; $i < 7; $i++) {
  if($week1[$i] == 'o') {
    $day[$i] = 1;
  } else {
    $day[$i] = 0;
  }
}
for($i = 0; $i < 7; $i++) {
  if($week2[$i] == 'o') {
    $day[$i + 7] = 1;
  } else {
    $day[$i + 7] = 0;
  }
}
$holiday = array();
for($i = 0; $i < 14; $i++) {
  if($day[$i] == 1) {
    if($i > 0) {
      $holiday[$i] = $holiday[$i - 1] + 1;
    } else {
      $holiday[$i] = 1;
    }
  } else {
    $holiday[$i] = 0;
  }
}
$ans = 0;
for($i = 0; $i < 14; $i++) {
  $ans = max($ans, $holiday[$i]);
}
print($ans);
?>
0