結果

問題 No.587 七対子
ユーザー htensaihtensai
提出日時 2019-11-14 19:09:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 2,862 ms
コンパイル使用メモリ 71,884 KB
実行使用メモリ 55,932 KB
最終ジャッジ日時 2023-09-27 02:32:58
合計ジャッジ時間 8,204 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,684 KB
testcase_01 AC 122 ms
55,468 KB
testcase_02 AC 121 ms
55,644 KB
testcase_03 AC 122 ms
55,384 KB
testcase_04 AC 122 ms
55,700 KB
testcase_05 AC 124 ms
55,864 KB
testcase_06 AC 124 ms
55,816 KB
testcase_07 AC 123 ms
55,536 KB
testcase_08 AC 124 ms
55,708 KB
testcase_09 AC 123 ms
55,300 KB
testcase_10 AC 123 ms
55,352 KB
testcase_11 AC 125 ms
53,480 KB
testcase_12 AC 125 ms
55,600 KB
testcase_13 AC 123 ms
55,752 KB
testcase_14 AC 122 ms
55,392 KB
testcase_15 AC 122 ms
55,608 KB
testcase_16 AC 120 ms
55,536 KB
testcase_17 AC 125 ms
55,884 KB
testcase_18 AC 123 ms
55,712 KB
testcase_19 AC 125 ms
55,740 KB
testcase_20 AC 124 ms
55,616 KB
testcase_21 AC 121 ms
55,816 KB
testcase_22 AC 121 ms
55,556 KB
testcase_23 AC 120 ms
53,672 KB
testcase_24 AC 121 ms
55,412 KB
testcase_25 AC 123 ms
55,692 KB
testcase_26 AC 120 ms
55,804 KB
testcase_27 AC 121 ms
55,624 KB
testcase_28 AC 125 ms
55,792 KB
testcase_29 AC 127 ms
55,604 KB
testcase_30 AC 122 ms
55,812 KB
testcase_31 AC 121 ms
55,524 KB
testcase_32 AC 121 ms
55,700 KB
testcase_33 AC 120 ms
53,640 KB
testcase_34 AC 120 ms
55,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		int[] counts = new int[26];
		for (char c : arr) {
		    counts[c - 'a']++;
		}
		char ans = ' ';
		boolean flag = true;
		for (int i = 0; i < 26; i++) {
		    if (counts[i] == 0 || counts[i] == 2) {
		        continue;
		    } else if (flag && counts[i] == 1) {
		        flag = false;
		        ans = (char) (i + 'a');
		    } else {
		        System.out.println("Impossible");
		        return;
		    }
		}
	    System.out.println(ans);
	}
}
0