結果

問題 No.548 国士無双
ユーザー mencottonmencotton
提出日時 2018-02-19 16:54:30
言語 C#(csc)
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 978 bytes
コンパイル時間 2,156 ms
コンパイル使用メモリ 104,872 KB
実行使用メモリ 22,756 KB
最終ジャッジ日時 2023-09-19 08:44:29
合計ジャッジ時間 4,483 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
20,436 KB
testcase_01 AC 51 ms
22,492 KB
testcase_02 AC 51 ms
22,492 KB
testcase_03 AC 51 ms
20,488 KB
testcase_04 AC 50 ms
20,392 KB
testcase_05 AC 51 ms
22,536 KB
testcase_06 AC 51 ms
20,548 KB
testcase_07 AC 52 ms
22,380 KB
testcase_08 AC 50 ms
20,384 KB
testcase_09 AC 50 ms
20,636 KB
testcase_10 AC 51 ms
20,452 KB
testcase_11 AC 50 ms
20,368 KB
testcase_12 AC 50 ms
20,500 KB
testcase_13 AC 51 ms
22,416 KB
testcase_14 AC 51 ms
22,588 KB
testcase_15 AC 51 ms
20,488 KB
testcase_16 AC 51 ms
22,556 KB
testcase_17 AC 51 ms
20,448 KB
testcase_18 AC 52 ms
22,440 KB
testcase_19 AC 51 ms
20,484 KB
testcase_20 AC 51 ms
20,592 KB
testcase_21 AC 53 ms
22,496 KB
testcase_22 WA -
testcase_23 AC 52 ms
20,544 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace _548
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int[] a = new int[26];
            bool flag = true;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] > 'm') flag = false;
                a[s[i] - 'a']++;
            }
            if (flag)
            {
                int two = 0; char ret = ' ';
                for (int j = 0; j <= 'm' - 'a'; j++)
                {
                    if (a[j] >= 2) two++;
                    else if (a[j] == 0) ret = (char)(j + 'a');
                }
                if (two > 1) Console.WriteLine("Impossible");
                else if (two == 1) Console.WriteLine(ret);
                else
                {
                    for (char i = 'a'; i <= 'm'; i++) Console.WriteLine(i);
                }
            }
            else Console.WriteLine("Impossible");
        }
    }
}
0