結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
41,124 KB
testcase_01 AC 130 ms
40,956 KB
testcase_02 AC 133 ms
41,688 KB
testcase_03 AC 129 ms
41,296 KB
testcase_04 AC 128 ms
41,240 KB
testcase_05 AC 131 ms
41,264 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 134 ms
41,252 KB
testcase_10 AC 131 ms
41,192 KB
testcase_11 WA -
testcase_12 AC 132 ms
40,892 KB
testcase_13 AC 132 ms
41,408 KB
testcase_14 AC 132 ms
41,296 KB
testcase_15 AC 130 ms
41,248 KB
testcase_16 AC 132 ms
41,480 KB
testcase_17 AC 133 ms
41,192 KB
testcase_18 AC 130 ms
40,976 KB
testcase_19 AC 133 ms
41,212 KB
testcase_20 AC 130 ms
41,496 KB
testcase_21 AC 131 ms
41,092 KB
testcase_22 AC 130 ms
41,228 KB
testcase_23 AC 130 ms
41,240 KB
testcase_24 AC 130 ms
41,196 KB
testcase_25 AC 131 ms
41,268 KB
testcase_26 AC 132 ms
41,080 KB
testcase_27 AC 135 ms
41,532 KB
testcase_28 WA -
testcase_29 AC 135 ms
41,188 KB
testcase_30 AC 132 ms
41,184 KB
testcase_31 AC 137 ms
41,212 KB
testcase_32 AC 132 ms
41,276 KB
testcase_33 AC 134 ms
41,324 KB
testcase_34 AC 134 ms
41,244 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)){
				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, "");
				}
			}
		}

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

	}

}
0