結果
問題 |
No.279 木の数え上げ
|
ユーザー |
![]() |
提出日時 | 2017-05-02 22:01:17 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 181 ms / 2,000 ms |
コード長 | 914 bytes |
コンパイル時間 | 2,048 ms |
コンパイル使用メモリ | 74,268 KB |
実行使用メモリ | 42,624 KB |
最終ジャッジ日時 | 2024-09-14 04:47:35 |
合計ジャッジ時間 | 5,605 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String S = reader.readLine(); int T = 0; int R = 0; int E = 0; for (int i = 0; i < S.length(); i++) { char s = S.charAt(i); if (s == 't') { T += 1; } else if (s == 'r') { R += 1; } else if (s == 'e') { E += 1; } } int treeCounter = 0; while ((T > 0) && (R > 0) && (E > 1)) { T -= 1; R -= 1; E -= 2; treeCounter += 1; } System.out.println(treeCounter); } }