結果
| 問題 | No.279 木の数え上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-12 18:17:55 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 221 ms / 2,000 ms |
| コード長 | 653 bytes |
| 記録 | |
| コンパイル時間 | 1,633 ms |
| コンパイル使用メモリ | 82,008 KB |
| 実行使用メモリ | 53,220 KB |
| 最終ジャッジ日時 | 2026-05-12 08:37:13 |
| 合計ジャッジ時間 | 6,182 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / tmp-judge_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
System.out.println(countTrees(input));
}
public static int countTrees(final String input) {
int tQty = 0;
int rQty = 0;
int eQty = 0;
for(int i = 0; i < input.length(); i++) {
if(input.charAt(i) == 't') {
tQty++;
}
if(input.charAt(i) == 'r') {
rQty++;
}
if(input.charAt(i) == 'e') {
eQty++;
}
}
eQty /= 2;
int treeQty = 0;
while (tQty > 0 && rQty > 0 && eQty > 0) {
tQty--;
rQty--;
eQty--;
treeQty++;
}
return treeQty;
}
}