結果

問題 No.587 七対子
ユーザー stone_725stone_725
提出日時 2017-11-03 22:39:43
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 1,375 bytes
コンパイル時間 2,182 ms
コンパイル使用メモリ 107,072 KB
実行使用メモリ 24,536 KB
最終ジャッジ日時 2023-09-27 02:11:12
合計ジャッジ時間 5,315 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
22,484 KB
testcase_01 AC 51 ms
20,508 KB
testcase_02 AC 52 ms
22,504 KB
testcase_03 AC 52 ms
20,608 KB
testcase_04 AC 52 ms
22,476 KB
testcase_05 AC 52 ms
22,548 KB
testcase_06 AC 51 ms
20,424 KB
testcase_07 AC 52 ms
22,564 KB
testcase_08 AC 51 ms
22,464 KB
testcase_09 AC 51 ms
20,556 KB
testcase_10 AC 50 ms
20,512 KB
testcase_11 AC 50 ms
20,520 KB
testcase_12 AC 51 ms
20,524 KB
testcase_13 AC 52 ms
20,432 KB
testcase_14 AC 52 ms
20,456 KB
testcase_15 AC 52 ms
20,616 KB
testcase_16 AC 52 ms
22,460 KB
testcase_17 AC 51 ms
20,452 KB
testcase_18 AC 51 ms
20,572 KB
testcase_19 AC 52 ms
20,656 KB
testcase_20 AC 53 ms
22,556 KB
testcase_21 AC 52 ms
22,656 KB
testcase_22 AC 52 ms
22,568 KB
testcase_23 AC 52 ms
20,604 KB
testcase_24 AC 51 ms
20,604 KB
testcase_25 AC 52 ms
20,644 KB
testcase_26 AC 51 ms
18,564 KB
testcase_27 AC 53 ms
20,616 KB
testcase_28 AC 52 ms
20,620 KB
testcase_29 AC 52 ms
18,468 KB
testcase_30 AC 52 ms
22,664 KB
testcase_31 AC 52 ms
20,604 KB
testcase_32 AC 53 ms
24,536 KB
testcase_33 AC 52 ms
22,596 KB
testcase_34 AC 53 ms
20,572 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
  static void Main()
  {
    solve();
  }
  static int CountChar(string s, char c)
  {
    return s.Length - s.Replace(c.ToString(), "").Length;
  }

  static void solve()
  {
    Scanner scanner = new Scanner();
    string str = scanner.next();
    char ans = ' ';
    for (char c = 'a'; c <= 'z'; c++)
    {
      if (CountChar(str, c) > 2)
      {
        Console.WriteLine("Impossible");
        return;
      }
      if (CountChar(str, c) == 1)
      {
        if (ans != ' ')
        {
          Console.WriteLine("Impossible");
          return;
        }
        else
        {
          ans = c;
        }
      }
    }
    Console.WriteLine(ans);
  }
}

class Scanner
{
  string[] s;
  int i;

  char[] cs = new char[] { ' ' };

  public Scanner()
  {
    s = new string[0];
    i = 0;
  }

  public string next()
  {
    if (i < s.Length) return s[i++];
    string st = Console.ReadLine();
    while (st == "") st = Console.ReadLine();
    s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
    i = 0;
    return next();
  }

  public int nextInt()
  {
    return int.Parse(next());
  }

  public long nextLong()
  {
    return long.Parse(next());
  }

  public double nextDouble()
  {
    return double.Parse(next());
  }

}
0