結果
| 問題 | No.587 七対子 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-11-14 15:59:14 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 919 bytes | 
| コンパイル時間 | 851 ms | 
| コンパイル使用メモリ | 112,136 KB | 
| 実行使用メモリ | 29,156 KB | 
| 最終ジャッジ日時 | 2024-11-25 02:05:18 | 
| 合計ジャッジ時間 | 2,761 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 1 WA * 34 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Linq;
using static System.Console;
namespace No587
{
    class Program
    {
        static void Main(string[] args)
        {
            var chars = "ymxhyrgrgssmx".ToCharArray();// 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;
    }
}
            
            
            
        