結果

問題 No.587 七対子
ユーザー 37zigen37zigen
提出日時 2020-02-18 18:03:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 703 bytes
コンパイル時間 2,152 ms
コンパイル使用メモリ 72,188 KB
実行使用メモリ 56,268 KB
最終ジャッジ日時 2023-09-27 02:35:18
合計ジャッジ時間 7,949 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,680 KB
testcase_01 AC 126 ms
55,904 KB
testcase_02 AC 124 ms
55,636 KB
testcase_03 AC 124 ms
55,720 KB
testcase_04 AC 123 ms
55,928 KB
testcase_05 AC 121 ms
56,268 KB
testcase_06 AC 124 ms
55,900 KB
testcase_07 AC 123 ms
55,768 KB
testcase_08 AC 122 ms
55,396 KB
testcase_09 AC 118 ms
55,544 KB
testcase_10 AC 121 ms
55,652 KB
testcase_11 AC 120 ms
55,872 KB
testcase_12 AC 121 ms
55,964 KB
testcase_13 AC 121 ms
55,552 KB
testcase_14 AC 121 ms
56,004 KB
testcase_15 AC 121 ms
55,328 KB
testcase_16 AC 120 ms
55,636 KB
testcase_17 AC 122 ms
55,736 KB
testcase_18 AC 120 ms
55,516 KB
testcase_19 AC 124 ms
55,472 KB
testcase_20 AC 126 ms
55,644 KB
testcase_21 AC 124 ms
55,636 KB
testcase_22 AC 122 ms
55,640 KB
testcase_23 AC 121 ms
55,744 KB
testcase_24 AC 123 ms
55,364 KB
testcase_25 AC 122 ms
55,516 KB
testcase_26 AC 125 ms
55,852 KB
testcase_27 AC 121 ms
55,568 KB
testcase_28 AC 122 ms
55,656 KB
testcase_29 AC 121 ms
55,640 KB
testcase_30 AC 124 ms
55,908 KB
testcase_31 AC 121 ms
56,080 KB
testcase_32 AC 120 ms
55,972 KB
testcase_33 AC 123 ms
55,576 KB
testcase_34 AC 123 ms
55,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		char[] cs=sc.next().toCharArray();
		int[] cnt=new int[26];
		for(int i=0;i<cs.length;++i) {
			cnt[(int)(cs[i]-'a')]++;
		}
		int c2=0,c1=0,idx=-1;
		for(int i=0;i<cnt.length;++i) {
			if(cnt[i]==2)++c2;
			else if(cnt[i]==1) {
				++c1;
				idx=i;
			}
		}
		if(c2==6&&c1==1) {
			System.out.println((char)('a'+idx));
		}else {
			System.out.println("Impossible");
		}
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
	
}
0