結果

問題 No.587 七対子
ユーザー kani_senbeikani_senbei
提出日時 2017-12-03 22:58:59
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 775 bytes
コンパイル時間 2,276 ms
コンパイル使用メモリ 76,868 KB
実行使用メモリ 41,496 KB
最終ジャッジ日時 2024-05-06 09:23:00
合計ジャッジ時間 7,827 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 126 ms
41,108 KB
testcase_02 AC 123 ms
41,252 KB
testcase_03 AC 129 ms
41,496 KB
testcase_04 AC 128 ms
40,868 KB
testcase_05 AC 125 ms
40,948 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 127 ms
41,356 KB
testcase_10 AC 113 ms
40,056 KB
testcase_11 WA -
testcase_12 AC 125 ms
41,040 KB
testcase_13 AC 126 ms
41,008 KB
testcase_14 AC 126 ms
41,204 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 130 ms
41,028 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 127 ms
40,880 KB
testcase_33 AC 126 ms
40,956 KB
testcase_34 AC 127 ms
41,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		HashMap<String, Integer> m = new HashMap<>();
		for (int i = 0; i < s.length(); i++) {
			String str = s.substring(i, i + 1);
			if (m.containsKey(str)) {
				m.put(str, m.get(str) + 1);
			} else {
				m.put(str, 1);
			}
		}
		boolean b = true;
		for (Map.Entry<String, Integer> entry : m.entrySet()) {
			if (entry.getValue() % 2 == 0) {
				continue;
			} else if (entry.getValue().equals(new Integer(1))) {
				System.out.println(entry.getKey());
				b = false;
			}
		}
		if (b)
			System.out.println("Impossible");
	}
}
0