結果

問題 No.548 国士無双
ユーザー akichi
提出日時 2017-08-02 01:53:20
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 906 bytes
コンパイル時間 847 ms
コンパイル使用メモリ 110,824 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-09-17 13:41:51
合計ジャッジ時間 2,289 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

    using System;

    class Program {
        static void Main(string[] args) {
            string answer = null;

            string read = Console.ReadLine();
            char[] cs = read.ToCharArray();
            Array.Sort(cs);

            if (new string(cs) == "abcdefghijklm") {
                answer = @"a
b
c
d
e
f
g
h
i
j
k
l
m";
            } else {

                for (char c = 'a'; c < 'n'; c++) {
                    int cnt = 13 - read.Replace(c.ToString(), "").Length;
                    if (cnt == 0) {
                        if (answer == null) {
                            answer = c.ToString();
                        } else {
                            answer = "Impossible";
                            break;
                        }
                    }
                }
            }
            Console.WriteLine(answer);
            Console.Read();

        }
    }
0