結果

問題 No.587 七対子
ユーザー shinwisteriashinwisteria
提出日時 2018-03-08 19:21:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 778 bytes
コンパイル時間 4,266 ms
コンパイル使用メモリ 75,572 KB
実行使用メモリ 41,708 KB
最終ジャッジ日時 2024-04-15 12:19:39
合計ジャッジ時間 9,629 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
41,640 KB
testcase_01 WA -
testcase_02 AC 134 ms
41,292 KB
testcase_03 WA -
testcase_04 AC 134 ms
41,424 KB
testcase_05 AC 132 ms
41,284 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 133 ms
41,528 KB
testcase_10 AC 137 ms
41,448 KB
testcase_11 WA -
testcase_12 AC 134 ms
41,664 KB
testcase_13 AC 140 ms
41,268 KB
testcase_14 AC 137 ms
41,548 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 136 ms
41,164 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 135 ms
41,248 KB
testcase_33 AC 140 ms
41,280 KB
testcase_34 AC 136 ms
41,392 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 < 6;i++){
			String c = str.substring(0, 1);
			str = str.replaceFirst(c, "");
			if(delete.contains(c)){
				break;
			}else{
				delete.add(c);
			}
			if(str.indexOf(c) == -1 && !ft){
				ft = true;
				ans = c;
				continue;
			}else if(str.indexOf(c) == -1 && ft){
				System.out.println("Impossible");

				break;
			}
			str = str.replaceFirst(c, "");
		}

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

	}

}
0