結果

問題 No.587 七対子
ユーザー tentententen
提出日時 2020-11-04 11:40:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 591 bytes
コンパイル時間 1,609 ms
コンパイル使用メモリ 71,668 KB
実行使用メモリ 56,200 KB
最終ジャッジ日時 2023-09-29 15:45:01
合計ジャッジ時間 6,621 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
56,136 KB
testcase_01 AC 100 ms
55,516 KB
testcase_02 AC 96 ms
56,120 KB
testcase_03 AC 94 ms
55,660 KB
testcase_04 AC 93 ms
55,524 KB
testcase_05 AC 95 ms
55,384 KB
testcase_06 AC 94 ms
55,944 KB
testcase_07 AC 94 ms
54,192 KB
testcase_08 AC 96 ms
55,940 KB
testcase_09 AC 105 ms
55,792 KB
testcase_10 AC 97 ms
55,780 KB
testcase_11 AC 116 ms
55,776 KB
testcase_12 AC 96 ms
56,148 KB
testcase_13 AC 95 ms
55,692 KB
testcase_14 AC 97 ms
55,940 KB
testcase_15 AC 99 ms
56,200 KB
testcase_16 AC 97 ms
55,436 KB
testcase_17 AC 98 ms
55,640 KB
testcase_18 AC 95 ms
55,584 KB
testcase_19 AC 96 ms
56,144 KB
testcase_20 AC 97 ms
55,860 KB
testcase_21 AC 94 ms
55,580 KB
testcase_22 AC 93 ms
55,824 KB
testcase_23 AC 93 ms
55,484 KB
testcase_24 AC 96 ms
55,896 KB
testcase_25 AC 97 ms
55,836 KB
testcase_26 AC 96 ms
55,888 KB
testcase_27 AC 115 ms
55,864 KB
testcase_28 AC 95 ms
55,628 KB
testcase_29 AC 94 ms
56,084 KB
testcase_30 AC 97 ms
56,152 KB
testcase_31 AC 102 ms
55,792 KB
testcase_32 AC 95 ms
55,776 KB
testcase_33 AC 97 ms
56,036 KB
testcase_34 AC 108 ms
55,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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