結果

問題 No.587 七対子
ユーザー fal_rndfal_rnd
提出日時 2018-04-07 01:24:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 605 bytes
コンパイル時間 2,391 ms
コンパイル使用メモリ 84,428 KB
実行使用メモリ 56,804 KB
最終ジャッジ日時 2023-09-27 02:22:42
合計ジャッジ時間 8,056 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,092 KB
testcase_01 AC 127 ms
55,536 KB
testcase_02 AC 127 ms
55,928 KB
testcase_03 AC 125 ms
56,208 KB
testcase_04 AC 128 ms
55,896 KB
testcase_05 AC 125 ms
55,956 KB
testcase_06 AC 122 ms
56,380 KB
testcase_07 AC 124 ms
55,780 KB
testcase_08 AC 123 ms
56,100 KB
testcase_09 AC 122 ms
56,212 KB
testcase_10 AC 128 ms
55,980 KB
testcase_11 AC 123 ms
55,768 KB
testcase_12 AC 124 ms
56,524 KB
testcase_13 AC 124 ms
56,028 KB
testcase_14 AC 124 ms
56,404 KB
testcase_15 AC 121 ms
56,324 KB
testcase_16 AC 122 ms
55,692 KB
testcase_17 AC 121 ms
55,940 KB
testcase_18 AC 123 ms
56,048 KB
testcase_19 AC 124 ms
56,804 KB
testcase_20 AC 126 ms
54,096 KB
testcase_21 AC 125 ms
56,064 KB
testcase_22 AC 123 ms
53,828 KB
testcase_23 AC 123 ms
56,136 KB
testcase_24 AC 121 ms
56,272 KB
testcase_25 AC 123 ms
56,660 KB
testcase_26 AC 124 ms
55,924 KB
testcase_27 AC 125 ms
55,808 KB
testcase_28 AC 126 ms
56,140 KB
testcase_29 AC 125 ms
56,316 KB
testcase_30 AC 125 ms
56,136 KB
testcase_31 AC 123 ms
55,996 KB
testcase_32 AC 125 ms
56,648 KB
testcase_33 AC 124 ms
56,304 KB
testcase_34 AC 128 ms
55,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

class Main{
	static Scanner s=new Scanner(System.in);
	public static void main(String[]$){
		Map<Integer,Integer> c=new HashMap<>();
		s.next().chars().forEach(i->c.merge(i,1,Integer::sum));

		int[] a=c.values().stream()
				.mapToInt(i->i)
				.sorted().toArray();
		if(Arrays.equals(a,new int[]{1,2,2,2,2,2,2})){
			System.out.println(
					(char)(int)
					c.entrySet().stream()
							.filter(o->o.getValue()==1)
							.findFirst().get().getKey());
		}else
			System.out.println("Impossible");
	}
}
0