結果

問題 No.587 七対子
ユーザー papinianuspapinianus
提出日時 2017-11-14 15:59:53
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 886 bytes
コンパイル時間 2,264 ms
コンパイル使用メモリ 105,012 KB
実行使用メモリ 23,804 KB
最終ジャッジ日時 2023-09-27 02:15:30
合計ジャッジ時間 5,835 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,564 KB
testcase_01 AC 64 ms
23,804 KB
testcase_02 AC 64 ms
21,672 KB
testcase_03 AC 64 ms
21,728 KB
testcase_04 AC 64 ms
23,708 KB
testcase_05 AC 60 ms
21,628 KB
testcase_06 AC 61 ms
23,548 KB
testcase_07 AC 59 ms
19,544 KB
testcase_08 AC 60 ms
23,540 KB
testcase_09 AC 60 ms
23,600 KB
testcase_10 AC 63 ms
21,572 KB
testcase_11 AC 60 ms
21,476 KB
testcase_12 AC 64 ms
21,660 KB
testcase_13 AC 62 ms
19,464 KB
testcase_14 AC 63 ms
21,544 KB
testcase_15 AC 61 ms
23,532 KB
testcase_16 AC 60 ms
21,592 KB
testcase_17 AC 60 ms
21,532 KB
testcase_18 AC 60 ms
23,672 KB
testcase_19 AC 60 ms
21,480 KB
testcase_20 AC 60 ms
19,552 KB
testcase_21 AC 61 ms
23,644 KB
testcase_22 AC 60 ms
21,540 KB
testcase_23 AC 61 ms
23,504 KB
testcase_24 AC 61 ms
23,532 KB
testcase_25 AC 61 ms
23,556 KB
testcase_26 AC 60 ms
21,632 KB
testcase_27 AC 59 ms
19,520 KB
testcase_28 AC 59 ms
21,532 KB
testcase_29 AC 61 ms
21,636 KB
testcase_30 AC 61 ms
19,428 KB
testcase_31 AC 60 ms
23,560 KB
testcase_32 AC 63 ms
21,576 KB
testcase_33 AC 61 ms
23,572 KB
testcase_34 AC 63 ms
21,516 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
            var c = charGroup.Count();
            var n = charGroup.Select(x => x.Count()).ToArray();
            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