結果
問題 | No.279 木の数え上げ |
ユーザー |
![]() |
提出日時 | 2015-10-06 13:27:48 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 165 ms / 2,000 ms |
コード長 | 1,577 bytes |
コンパイル時間 | 2,170 ms |
コンパイル使用メモリ | 78,492 KB |
実行使用メモリ | 54,472 KB |
最終ジャッジ日時 | 2024-10-14 15:15:33 |
合計ジャッジ時間 | 5,084 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; public class Main{ public static void main(String[] args){ try { (new Solve()).solve(); } catch (NumberFormatException | IOException e) { e.printStackTrace(); } } } class Solve{ void solve() throws NumberFormatException, IOException{ final ContestScanner in = new ContestScanner(); char[] s = in.nextToken().toCharArray(); int[] alp = new int[26]; for(int i=0; i<s.length; i++){ alp[s[i]-'a']++; } System.out.println(Math.min(alp['r'-'a'], Math.min(alp['t'-'a'], alp['e'-'a']/2))); } } class ContestScanner { private BufferedReader reader; private String[] line; private int idx; public ContestScanner() throws FileNotFoundException { reader = new BufferedReader(new InputStreamReader(System.in)); } public ContestScanner(String filename) throws FileNotFoundException { reader = new BufferedReader(new InputStreamReader(new FileInputStream( filename))); } public String nextToken() throws IOException { if (line == null || line.length <= idx) { line = reader.readLine().trim().split(" "); idx = 0; } return line[idx++]; } public long nextLong() throws IOException, NumberFormatException { return Long.parseLong(nextToken()); } public int nextInt() throws NumberFormatException, IOException { return (int) nextLong(); } public double nextDouble() throws NumberFormatException, IOException { return Double.parseDouble(nextToken()); } }