結果

問題 No.587 七対子
ユーザー shinwisteriashinwisteria
提出日時 2018-03-08 20:02:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 828 bytes
コンパイル時間 4,353 ms
コンパイル使用メモリ 72,508 KB
実行使用メモリ 56,644 KB
最終ジャッジ日時 2023-09-27 02:21:47
合計ジャッジ時間 9,998 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,640 KB
testcase_01 AC 117 ms
56,188 KB
testcase_02 AC 114 ms
55,652 KB
testcase_03 AC 117 ms
55,952 KB
testcase_04 AC 114 ms
56,160 KB
testcase_05 AC 117 ms
55,612 KB
testcase_06 AC 116 ms
55,652 KB
testcase_07 AC 115 ms
55,708 KB
testcase_08 AC 113 ms
55,668 KB
testcase_09 AC 114 ms
56,296 KB
testcase_10 AC 120 ms
55,840 KB
testcase_11 AC 117 ms
55,492 KB
testcase_12 AC 118 ms
55,992 KB
testcase_13 AC 115 ms
55,568 KB
testcase_14 AC 117 ms
56,180 KB
testcase_15 AC 119 ms
53,648 KB
testcase_16 AC 118 ms
55,776 KB
testcase_17 AC 115 ms
55,784 KB
testcase_18 AC 118 ms
56,644 KB
testcase_19 AC 119 ms
55,808 KB
testcase_20 AC 115 ms
55,436 KB
testcase_21 AC 117 ms
55,624 KB
testcase_22 AC 116 ms
55,732 KB
testcase_23 AC 115 ms
55,564 KB
testcase_24 AC 115 ms
55,644 KB
testcase_25 AC 118 ms
55,416 KB
testcase_26 AC 118 ms
55,600 KB
testcase_27 AC 119 ms
55,840 KB
testcase_28 AC 115 ms
55,688 KB
testcase_29 AC 118 ms
56,040 KB
testcase_30 AC 117 ms
55,888 KB
testcase_31 AC 117 ms
56,140 KB
testcase_32 AC 118 ms
55,636 KB
testcase_33 AC 117 ms
56,232 KB
testcase_34 AC 117 ms
56,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.ArrayList;
import java.util.Scanner;
public class Con587 {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String str = s.next();
		s.close();

		ArrayList<String> delete = new ArrayList<>();
		boolean ft = false;
		String ans = "";
		for(int i = 0;i < 7;i++){
			String c = str.substring(0,1);
			str = str.substring(1, str.length());
			if(delete.contains(c)){
				ft = false;
				break;
			}else{
				delete.add(c);
				if(str.indexOf(c) == -1 && !ft){
					ft = true;
					ans = c;
					continue;
				}else if(str.indexOf(c) == -1 && ft){
					ft = false;
					break;
				}else{
					str = str.replaceFirst(c, "");
				}
			}
			//System.out.println(str);
		}

		if(ft){
			System.out.println(ans);
		}else{
			System.out.println("Impossible");
		}

	}

}
0