結果
| 問題 | No.587 七対子 |
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2018-09-10 15:29:14 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 688 bytes |
| 記録 | |
| コンパイル時間 | 753 ms |
| コンパイル使用メモリ | 107,264 KB |
| 実行使用メモリ | 18,560 KB |
| 最終ジャッジ日時 | 2024-07-19 19:55:08 |
| 合計ジャッジ時間 | 2,421 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Linq;
using System.Collections.Generic;
using System;
public class Hello
{
public static void Main()
{
var d = new Dictionary<char, int>();
var s = Console.ReadLine().Trim();
for (int i = 0; i < 13; i++)
if (d.ContainsKey(s[i])) d[s[i]]++;
else d[s[i]] = 1;
Console.WriteLine(getAns(d));
}
public static string getAns (Dictionary<char,int> d)
{
var ng = "Impossible";
if (d.Count() != 7) return ng;
var a = d.Count(x => x.Value == 1);
if (a == 1)
foreach (var x in d)
if (x.Value == 1) return x.Key.ToString();
return ng;
}
}
bluemegane