結果

問題 No.587 七対子
ユーザー ThhG_9l3ThhG_9l3
提出日時 2018-05-06 01:11:07
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 774 bytes
コンパイル時間 2,070 ms
コンパイル使用メモリ 80,024 KB
実行使用メモリ 58,128 KB
最終ジャッジ日時 2023-09-10 10:40:32
合計ジャッジ時間 7,662 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,788 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 118 ms
55,564 KB
testcase_16 AC 117 ms
55,776 KB
testcase_17 AC 118 ms
55,572 KB
testcase_18 WA -
testcase_19 AC 118 ms
55,524 KB
testcase_20 AC 118 ms
53,984 KB
testcase_21 AC 118 ms
55,692 KB
testcase_22 AC 120 ms
55,528 KB
testcase_23 AC 117 ms
55,388 KB
testcase_24 AC 117 ms
56,028 KB
testcase_25 AC 118 ms
55,560 KB
testcase_26 AC 117 ms
55,484 KB
testcase_27 AC 117 ms
55,812 KB
testcase_28 WA -
testcase_29 AC 118 ms
56,016 KB
testcase_30 AC 118 ms
55,896 KB
testcase_31 AC 118 ms
55,456 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukikoda;

import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ch = new char[13];
		String str = sc.next();
		int count = 0;
		ArrayList<Character> alpha = new ArrayList<Character>();

		for(int i=0; i<ch.length; i++) {
			ch[i] = str.charAt(i);
		}

		for(int k=0; k<12; k++) {
			for(int m=k+1; m<13; m++) {
				if(ch[k] == ch[m] && ch[k] != '/' && ch[m] != '/') {
						count++;
						alpha.add(ch[k]);
						ch[k] = '/';
						ch[m] = '/';
				}
			}
		}

		if(count == 6) {
			for(int l=0; l<13; l++) {
				if(ch[l] != '/' && alpha.contains(ch[l])) {
					System.out.println(ch[l]);
				}
			}
		}else {
			System.out.println("Impossible");
		}
	}
}
0