結果

問題 No.279 木の数え上げ
ユーザー
提出日時 2016-01-09 17:39:23
言語 PHP
(8.2.11)
結果
MLE  
実行時間 -
コード長 865 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 32,684 KB
実行使用メモリ 81,744 KB
最終ジャッジ日時 2023-10-19 16:56:08
合計ジャッジ時間 2,533 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
32,676 KB
testcase_01 AC 42 ms
32,676 KB
testcase_02 AC 42 ms
32,676 KB
testcase_03 AC 43 ms
32,676 KB
testcase_04 AC 42 ms
32,676 KB
testcase_05 AC 42 ms
32,676 KB
testcase_06 AC 43 ms
32,676 KB
testcase_07 AC 41 ms
32,676 KB
testcase_08 AC 46 ms
32,676 KB
testcase_09 AC 42 ms
32,676 KB
testcase_10 MLE -
testcase_11 AC 57 ms
42,760 KB
testcase_12 AC 84 ms
63,240 KB
testcase_13 AC 51 ms
38,664 KB
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 73 ms
55,048 KB
testcase_19 MLE -
testcase_20 MLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

fscanf(STDIN, "%s", $all);

$str = str_split($all);

$word_t = 0;
$word_r = 0;
$word_e = 0;

foreach($str as $word){
       if($word === "t"){
          $word_t ++;
       }else if($word === "r"){
          $word_r ++;
       }else if($word === "e"){
          $word_e ++;
       }
}

if($word_t > $word_r){
    $word_e_same = $word_r * 2;
}else{
    $word_e_same = $word_t * 2;
}

$word_e_diff = floor($word_e / 2);


if($word_t >= 1 && $word_r >= 1 && $word_e >= $word_e_same && $word_t > $word_r){
    echo $word_r;
}else if($word_t >= 1 && $word_r >= 1 && $word_e >= $word_e_same && $word_t < $word_r){
    echo $word_t;
}else if($word_t >= 1 && $word_r >= 1 && $word_e >= $word_e_same && $word_t == $word_r){
    echo $word_t;
}else if($word_t >= 1 && $word_r >= 1 && $word_e < $word_e_same && $word_e >= 2){
    echo $word_e_diff;
}else{
    echo 0;
}
0