結果

問題 No.203 ゴールデン・ウィーク(1)
ユーザー ayaaya
提出日時 2019-07-29 15:28:21
言語 PHP
(8.3.4)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 967 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 18,436 KB
実行使用メモリ 18,800 KB
最終ジャッジ日時 2023-09-15 11:54:12
合計ジャッジ時間 2,679 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
18,788 KB
testcase_01 AC 16 ms
18,692 KB
testcase_02 AC 16 ms
18,800 KB
testcase_03 AC 15 ms
18,756 KB
testcase_04 AC 16 ms
18,756 KB
testcase_05 AC 16 ms
18,724 KB
testcase_06 AC 16 ms
18,772 KB
testcase_07 AC 16 ms
18,800 KB
testcase_08 AC 15 ms
18,744 KB
testcase_09 AC 16 ms
18,744 KB
testcase_10 AC 15 ms
18,756 KB
testcase_11 AC 16 ms
18,784 KB
testcase_12 AC 16 ms
18,732 KB
testcase_13 AC 16 ms
18,696 KB
testcase_14 AC 16 ms
18,516 KB
testcase_15 AC 16 ms
18,760 KB
testcase_16 AC 16 ms
18,704 KB
testcase_17 AC 16 ms
18,708 KB
testcase_18 AC 16 ms
18,736 KB
testcase_19 AC 16 ms
18,792 KB
testcase_20 AC 16 ms
18,760 KB
testcase_21 AC 16 ms
18,800 KB
testcase_22 AC 15 ms
18,764 KB
testcase_23 AC 16 ms
18,780 KB
testcase_24 AC 16 ms
18,760 KB
testcase_25 AC 15 ms
18,716 KB
testcase_26 AC 16 ms
18,696 KB
testcase_27 AC 15 ms
18,736 KB
testcase_28 AC 16 ms
18,776 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
/**
 * No.203 ゴールデン・ウィーク(1)
 * 問題文
 *巷ではゴールデンウィークらしいです。
 *なのでゴールデンウィークっぽい問題です。
 *
 *2週間分の平日(x)と休日(o)が分かるカレンダーが与えられます。
 *この2週間の期間以外は、平日とします。
 *
 *最大の連休(連続の休日)数を求めてください。
 *
 *入力
 *C1C2....C7
 *C8C9....C14
 *Ciは、"x"か"o"の文字です。 "x"は平日、"o"は休日を表します。
 *C1,C2...,CNと連続している日を表すものとします。
 */

 
 $week1=str_split(trim(fgets(STDIN)));
 $week2=str_split(trim(fgets(STDIN)));
 $days=array_merge($week1,$week2);
 $consecutiveHolidays=0;
 $cnt=0;
 foreach($days as $key =>$value){
  if($value=="o"){
    $cnt++;
    if($consecutiveHolidays<$cnt){
      $consecutiveHolidays=$cnt;
    }
  }else if($value=="x"){
    $cnt =0;
  }
 }
 echo $consecutiveHolidays;
?>
0