結果

問題 No.548 国士無双
ユーザー matsuyoshi30matsuyoshi30
提出日時 2018-06-04 23:29:31
言語 Java19
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 736 bytes
コンパイル時間 3,170 ms
コンパイル使用メモリ 75,120 KB
実行使用メモリ 57,568 KB
最終ジャッジ日時 2023-10-17 17:28:34
合計ジャッジ時間 7,121 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
57,360 KB
testcase_01 AC 129 ms
57,416 KB
testcase_02 AC 123 ms
57,352 KB
testcase_03 AC 127 ms
57,480 KB
testcase_04 AC 124 ms
57,480 KB
testcase_05 AC 124 ms
57,568 KB
testcase_06 AC 124 ms
57,388 KB
testcase_07 AC 125 ms
57,444 KB
testcase_08 AC 122 ms
57,376 KB
testcase_09 AC 122 ms
57,468 KB
testcase_10 AC 130 ms
57,432 KB
testcase_11 AC 124 ms
55,500 KB
testcase_12 AC 123 ms
57,376 KB
testcase_13 AC 110 ms
56,200 KB
testcase_14 AC 120 ms
57,384 KB
testcase_15 AC 119 ms
57,372 KB
testcase_16 AC 122 ms
57,296 KB
testcase_17 AC 126 ms
57,376 KB
testcase_18 AC 129 ms
57,568 KB
testcase_19 AC 123 ms
57,324 KB
testcase_20 WA -
testcase_21 AC 125 ms
57,396 KB
testcase_22 AC 125 ms
57,404 KB
testcase_23 AC 130 ms
57,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int[] alph = new int[26];
        for(int i=0; i<s.length(); i++)
            alph[(s.charAt(i) - 'a')]++;

        int temp = 0;
        for(int i=0; i<13; i++) {
            if(alph[i] == 0) temp++;
        }

        if(temp > 2) {
            System.out.println("Impossible");
        } else if(temp == 1) {
            for(int i=0; i<13; i++) {
                if(alph[i] == 0)
                    System.out.println((char)(i+'a'));
            }
        } else {
            for(int i=0; i<13; i++)
                System.out.println((char)(i+'a'));
        }
    }
}
0