結果

問題 No.587 七対子
ユーザー ThhG_9l3
提出日時 2018-05-06 01:11:07
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 774 bytes
コンパイル時間 2,205 ms
コンパイル使用メモリ 78,060 KB
実行使用メモリ 41,548 KB
最終ジャッジ日時 2024-06-28 02:03:43
合計ジャッジ時間 7,266 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 19
権限があれば一括ダウンロードができます

ソースコード

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