結果

問題 No.548 国士無双
ユーザー villachvillach
提出日時 2017-09-24 14:45:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 722 bytes
コンパイル時間 3,388 ms
コンパイル使用メモリ 75,292 KB
実行使用メモリ 57,576 KB
最終ジャッジ日時 2023-10-17 16:21:48
合計ジャッジ時間 7,588 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
56,140 KB
testcase_01 AC 124 ms
57,356 KB
testcase_02 AC 124 ms
57,556 KB
testcase_03 AC 126 ms
57,504 KB
testcase_04 AC 120 ms
57,132 KB
testcase_05 AC 121 ms
57,512 KB
testcase_06 AC 118 ms
57,340 KB
testcase_07 AC 123 ms
57,388 KB
testcase_08 AC 120 ms
57,504 KB
testcase_09 AC 119 ms
57,124 KB
testcase_10 AC 120 ms
57,340 KB
testcase_11 AC 122 ms
57,576 KB
testcase_12 AC 119 ms
57,356 KB
testcase_13 AC 122 ms
57,348 KB
testcase_14 AC 122 ms
57,244 KB
testcase_15 AC 123 ms
57,388 KB
testcase_16 AC 124 ms
57,372 KB
testcase_17 AC 121 ms
57,108 KB
testcase_18 AC 123 ms
57,344 KB
testcase_19 AC 119 ms
57,120 KB
testcase_20 AC 119 ms
57,364 KB
testcase_21 AC 124 ms
57,200 KB
testcase_22 AC 122 ms
57,060 KB
testcase_23 AC 111 ms
55,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.ArrayList;
import java.util.Scanner;

public class N548 {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int[] chars = new int[13];
		char c, shortageChar = 0;
		int zeroCount = 0;
		
		for(int i = 0;i < 13;++i){
			c = s.charAt(i);
			c -= 97;
			if(c < 13){
				chars[c] += 1;
			}
		}
		
		for(int i = 0;i < 13;++i){
			if(chars[i] == 0){
				++zeroCount;
				shortageChar = (char) (97 + i);
			}
		}
		
		if(zeroCount == 0){
			for(int i = 0;i < 13;++i){
				System.out.println((char) (97 + i)); 
			}
		}else if(zeroCount == 1){
			System.out.println(shortageChar);
		}else{
			System.out.println("Impossible");
		}
	}
}
0