結果

問題 No.3020 サンシャイン◯崎
ユーザー fal_rndfal_rnd
提出日時 2017-03-31 22:25:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 229 ms / 1,000 ms
コード長 922 bytes
コンパイル時間 5,163 ms
コンパイル使用メモリ 75,984 KB
実行使用メモリ 59,304 KB
最終ジャッジ日時 2023-08-25 01:50:09
合計ジャッジ時間 8,061 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,112 KB
testcase_01 AC 120 ms
55,900 KB
testcase_02 AC 125 ms
56,432 KB
testcase_03 AC 120 ms
56,236 KB
testcase_04 AC 121 ms
56,312 KB
testcase_05 AC 219 ms
58,780 KB
testcase_06 AC 127 ms
55,788 KB
testcase_07 AC 126 ms
55,940 KB
testcase_08 AC 190 ms
58,144 KB
testcase_09 AC 192 ms
56,124 KB
testcase_10 AC 213 ms
58,948 KB
testcase_11 AC 206 ms
58,864 KB
testcase_12 AC 229 ms
58,848 KB
testcase_13 AC 218 ms
58,784 KB
testcase_14 AC 219 ms
59,124 KB
testcase_15 AC 215 ms
59,304 KB
testcase_16 AC 212 ms
58,888 KB
testcase_17 AC 218 ms
57,024 KB
testcase_18 AC 217 ms
58,856 KB
testcase_19 AC 220 ms
58,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashMap;
import java.util.Scanner;

public class Main{

	static Scanner s=new Scanner(System.in);

	public static void main(String __[]){
		input();
		solve();
	}

	private static void input(){
	}

	private static void solve(){
		char[] in=s.next().toCharArray();
		Counter<Character> c = new Counter<>();
		c.add('Y',0);
		c.add('E',0);
		c.add('A',0);
		c.add('H',0);
		c.add('!',0);
		for(char ch:in)
			c.add(ch);
		System.out.printf("%d %d %d %d %d\n",
				c.map.get('Y'),
				c.map.get('E'),
				c.map.get('A'),
				c.map.get('H'),
				c.map.get('!')
				);
	}
}

class Counter<T>{
	public HashMap<T, Integer> map;
	public Counter(int initSize) {
		map = new HashMap<>(initSize);
	}
	public Counter() {
		this(10);
	}
	public void add(T key, int v) {
		Integer i;
		if((i=map.get(key))==null) {
			map.put(key, v);
		}else {
			map.put(key, i+v);
		}
	}
	public void add(T key) {
		add(key,1);
	}
}
0