結果

問題 No.587 七対子
ユーザー fukuseifukusei
提出日時 2018-05-05 17:59:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 663 bytes
コンパイル時間 3,688 ms
コンパイル使用メモリ 74,088 KB
実行使用メモリ 57,188 KB
最終ジャッジ日時 2023-09-27 02:23:18
合計ジャッジ時間 10,470 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
56,788 KB
testcase_01 AC 158 ms
57,188 KB
testcase_02 AC 157 ms
56,764 KB
testcase_03 AC 159 ms
56,864 KB
testcase_04 AC 162 ms
56,436 KB
testcase_05 AC 159 ms
56,740 KB
testcase_06 AC 160 ms
56,824 KB
testcase_07 AC 160 ms
56,944 KB
testcase_08 AC 156 ms
56,680 KB
testcase_09 AC 156 ms
56,600 KB
testcase_10 AC 155 ms
56,784 KB
testcase_11 AC 161 ms
56,496 KB
testcase_12 AC 160 ms
56,832 KB
testcase_13 AC 162 ms
56,740 KB
testcase_14 AC 161 ms
57,028 KB
testcase_15 AC 161 ms
56,860 KB
testcase_16 AC 159 ms
56,856 KB
testcase_17 AC 157 ms
56,640 KB
testcase_18 AC 159 ms
56,452 KB
testcase_19 AC 159 ms
56,848 KB
testcase_20 AC 161 ms
56,436 KB
testcase_21 AC 159 ms
56,800 KB
testcase_22 AC 160 ms
56,748 KB
testcase_23 AC 161 ms
56,712 KB
testcase_24 AC 161 ms
56,844 KB
testcase_25 AC 163 ms
56,668 KB
testcase_26 AC 162 ms
56,844 KB
testcase_27 AC 161 ms
56,720 KB
testcase_28 AC 159 ms
56,896 KB
testcase_29 AC 161 ms
56,864 KB
testcase_30 AC 158 ms
56,876 KB
testcase_31 AC 158 ms
56,784 KB
testcase_32 AC 157 ms
56,408 KB
testcase_33 AC 157 ms
56,936 KB
testcase_34 AC 158 ms
56,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class paiza {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		int count = 0;
		String match = "";
		char ch;
		
		for (int i = 0; i < str.length(); i++) {
			ch = str.charAt(i);
			if ( str.indexOf(ch,i+1) != -1) {
				if ( match.indexOf(ch) == -1 ){
					count++;
					match = match + ch;
				}
			}
		}
		
		if (count == 6) {
			for(int i=0; i<str.length(); i++) {
				if(match.indexOf(str.charAt(i)) == -1){
					System.out.println(str.charAt(i));
					return;
				}
			}
			System.out.println("Impossible");
		}
		else {
			System.out.println("Impossible");
		}
	}
}
0