結果

問題 No.587 七対子
ユーザー papinianuspapinianus
提出日時 2017-11-14 15:55:44
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 784 bytes
コンパイル時間 2,421 ms
コンパイル使用メモリ 106,804 KB
実行使用メモリ 25,544 KB
最終ジャッジ日時 2023-08-16 13:05:34
合計ジャッジ時間 6,447 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 56 ms
23,180 KB
testcase_06 AC 55 ms
21,236 KB
testcase_07 AC 55 ms
21,176 KB
testcase_08 AC 56 ms
21,236 KB
testcase_09 AC 55 ms
21,172 KB
testcase_10 WA -
testcase_11 AC 56 ms
21,256 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 55 ms
21,344 KB
testcase_16 RE -
testcase_17 AC 58 ms
21,228 KB
testcase_18 AC 55 ms
21,120 KB
testcase_19 AC 57 ms
21,244 KB
testcase_20 AC 55 ms
21,184 KB
testcase_21 AC 55 ms
21,252 KB
testcase_22 AC 55 ms
21,196 KB
testcase_23 AC 56 ms
23,188 KB
testcase_24 AC 55 ms
21,176 KB
testcase_25 AC 56 ms
19,092 KB
testcase_26 AC 56 ms
21,344 KB
testcase_27 AC 55 ms
21,152 KB
testcase_28 AC 55 ms
21,244 KB
testcase_29 AC 59 ms
23,268 KB
testcase_30 RE -
testcase_31 AC 56 ms
23,204 KB
testcase_32 WA -
testcase_33 AC 55 ms
23,232 KB
testcase_34 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Linq;
using static System.Console;

namespace No587
{
    class Program
    {
        static void Main(string[] args)
        {
            var chars = ReadLine().ToCharArray();
            if (WillBeSevenPair(chars))
            {
                WriteLine(FindSoloChar(chars));
                return;
            }
            WriteLine("Impossible");
            return;
        }

        static bool WillBeSevenPair(char[] chars)
        {
            var charGroup = chars.GroupBy(x => x);
            return charGroup.Count() == 7 && !charGroup.Select(x=>x.Count()).All(y => y == 1 || y == 2);
        }
        static char FindSoloChar(char[] chars) => chars.GroupBy(x => x).Select(x => new { chr = x.Key, cnt = x.Count() }).Single(y => y.cnt == 1).chr;
    }
}
0