結果

問題 No.587 七対子
ユーザー kani_senbeikani_senbei
提出日時 2017-12-03 22:56:28
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 789 bytes
コンパイル時間 2,423 ms
コンパイル使用メモリ 77,320 KB
実行使用メモリ 41,624 KB
最終ジャッジ日時 2024-05-06 09:22:46
合計ジャッジ時間 7,816 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 102 ms
40,656 KB
testcase_02 AC 107 ms
41,168 KB
testcase_03 AC 104 ms
39,736 KB
testcase_04 AC 103 ms
40,044 KB
testcase_05 AC 103 ms
40,284 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 105 ms
41,084 KB
testcase_10 AC 96 ms
39,688 KB
testcase_11 WA -
testcase_12 AC 96 ms
39,712 KB
testcase_13 AC 105 ms
41,068 KB
testcase_14 AC 100 ms
40,044 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 116 ms
41,156 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 111 ms
40,000 KB
testcase_33 AC 115 ms
40,688 KB
testcase_34 AC 104 ms
40,336 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().equals(new Integer(2))) {
				continue;
			} else if (entry.getValue().equals(new Integer(1))) {
				System.out.println(entry.getKey());
				b = false;
			}
		}
		if (b)
			System.out.println("Impossible");
	}
}
0