結果

問題 No.548 国士無双
ユーザー shinwisteriashinwisteria
提出日時 2018-03-08 21:10:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 802 bytes
コンパイル時間 4,461 ms
コンパイル使用メモリ 77,852 KB
実行使用メモリ 57,684 KB
最終ジャッジ日時 2023-10-17 17:23:04
合計ジャッジ時間 7,625 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,216 KB
testcase_01 AC 128 ms
57,476 KB
testcase_02 AC 127 ms
57,412 KB
testcase_03 AC 127 ms
57,392 KB
testcase_04 AC 125 ms
57,372 KB
testcase_05 AC 126 ms
57,684 KB
testcase_06 AC 117 ms
56,212 KB
testcase_07 AC 124 ms
57,444 KB
testcase_08 AC 126 ms
57,200 KB
testcase_09 AC 126 ms
57,444 KB
testcase_10 AC 124 ms
57,172 KB
testcase_11 AC 124 ms
57,452 KB
testcase_12 AC 126 ms
57,484 KB
testcase_13 AC 124 ms
57,456 KB
testcase_14 AC 128 ms
57,448 KB
testcase_15 AC 129 ms
57,512 KB
testcase_16 AC 128 ms
57,484 KB
testcase_17 AC 128 ms
57,488 KB
testcase_18 AC 127 ms
57,648 KB
testcase_19 AC 129 ms
57,452 KB
testcase_20 AC 126 ms
57,368 KB
testcase_21 AC 131 ms
55,460 KB
testcase_22 AC 126 ms
57,444 KB
testcase_23 AC 128 ms
57,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

		boolean ans = false;
		byte[] b = str.getBytes();
		int[] a = new int[110];
		try{
			for(int i = 0;i < 13;i++){
				a[b[i]]++;
				if(a[b[i]] > 2){
					a[111]++;
				}else if(a[b[i]] == 2 && !ans){
					ans = true;
				}else if(a[b[i]] == 2 && ans){
					a[111]++;
				}
			}
			if(ans){
				for(byte i = 97;i < 110;i++){
					if(a[i] == 0){
						byte[] b2 = {i};
						System.out.println(new String(b2));
					}
				}
			}else{
				for(byte i = 97 ;i < 110;i++){
					byte[] b2 = {i};
					System.out.println(new String(b2));
				}
			}

		}catch(Exception e){
			System.out.println("Impossible");
		}
	}

}
0