結果

問題 No.279 木の数え上げ
ユーザー
提出日時 2016-01-09 17:28:18
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 724 bytes
コンパイル時間 4,463 ms
コンパイル使用メモリ 32,172 KB
実行使用メモリ 81,480 KB
最終ジャッジ日時 2023-10-19 16:56:05
合計ジャッジ時間 3,810 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 45 ms
32,484 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 MLE -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 WA -
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;
}


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{
    echo 0;
}
0