結果

問題 No.279 木の数え上げ
ユーザー matsuyoshimatsuyoshi
提出日時 2017-07-03 22:54:09
言語 Java21
(openjdk 21)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 595 bytes
コンパイル時間 2,202 ms
コンパイル使用メモリ 74,900 KB
実行使用メモリ 64,160 KB
最終ジャッジ日時 2024-04-15 14:49:33
合計ジャッジ時間 8,870 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
41,580 KB
testcase_01 AC 139 ms
41,204 KB
testcase_02 AC 137 ms
41,192 KB
testcase_03 AC 135 ms
41,684 KB
testcase_04 AC 136 ms
41,544 KB
testcase_05 AC 140 ms
41,596 KB
testcase_06 AC 135 ms
41,596 KB
testcase_07 AC 137 ms
41,360 KB
testcase_08 AC 139 ms
41,424 KB
testcase_09 AC 138 ms
41,388 KB
testcase_10 AC 425 ms
51,552 KB
testcase_11 AC 311 ms
47,216 KB
testcase_12 AC 389 ms
51,464 KB
testcase_13 AC 256 ms
46,512 KB
testcase_14 AC 423 ms
51,944 KB
testcase_15 MLE -
testcase_16 AC 396 ms
51,972 KB
testcase_17 AC 424 ms
51,628 KB
testcase_18 AC 354 ms
48,636 KB
testcase_19 AC 425 ms
51,748 KB
testcase_20 AC 404 ms
51,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {
  public static void main(String[] args) throws Exception {
    Scanner in = new Scanner(System.in);
    String s = in.nextLine();
    in.close();

    String str;
    int t = 0;
    int r = 0;
    int e = 0;
    int tree = 0;
    int memory = 0;
    for(int i=1; i<=s.length(); i++) {
      str = s.substring(i-1,i);
      if(str.equals("t")) t++;
      if(str.equals("r")) r++;
      if(str.equals("e")) e++;
    }

    memory = t;
    if(memory > r) memory = r;
    if(memory > e/2) memory = e/2;
    tree = memory;

    System.out.println(tree);
  }
}
0