結果

問題 No.587 七対子
ユーザー mbanmban
提出日時 2017-12-01 17:44:40
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 2,038 bytes
コンパイル時間 3,615 ms
コンパイル使用メモリ 104,608 KB
実行使用メモリ 22,572 KB
最終ジャッジ日時 2023-09-27 02:16:41
合計ジャッジ時間 6,873 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
20,596 KB
testcase_01 AC 52 ms
20,496 KB
testcase_02 AC 51 ms
20,408 KB
testcase_03 AC 52 ms
20,424 KB
testcase_04 AC 52 ms
22,520 KB
testcase_05 AC 52 ms
22,544 KB
testcase_06 AC 52 ms
20,564 KB
testcase_07 AC 51 ms
18,380 KB
testcase_08 AC 52 ms
18,500 KB
testcase_09 AC 52 ms
22,532 KB
testcase_10 AC 52 ms
20,540 KB
testcase_11 AC 52 ms
20,328 KB
testcase_12 AC 52 ms
22,452 KB
testcase_13 AC 53 ms
22,532 KB
testcase_14 AC 52 ms
20,616 KB
testcase_15 AC 53 ms
20,556 KB
testcase_16 AC 52 ms
18,512 KB
testcase_17 AC 53 ms
20,500 KB
testcase_18 AC 52 ms
20,572 KB
testcase_19 AC 52 ms
22,552 KB
testcase_20 AC 52 ms
20,328 KB
testcase_21 AC 52 ms
20,660 KB
testcase_22 AC 51 ms
18,524 KB
testcase_23 AC 53 ms
20,556 KB
testcase_24 AC 52 ms
20,560 KB
testcase_25 AC 52 ms
20,592 KB
testcase_26 AC 52 ms
22,440 KB
testcase_27 AC 52 ms
20,484 KB
testcase_28 AC 52 ms
20,672 KB
testcase_29 AC 53 ms
22,532 KB
testcase_30 AC 53 ms
22,448 KB
testcase_31 AC 52 ms
22,572 KB
testcase_32 AC 52 ms
20,488 KB
testcase_33 AC 51 ms
20,396 KB
testcase_34 AC 56 ms
20,332 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 Scanner
{
    private readonly char Separator = ' ';
    private int Index = 0;
    private string[] Line = new string[0];
    public string Next()
    {
        if (Index >= Line.Length)
        {
            Line = Console.ReadLine().Split(Separator);
            Index = 0;
        }
        var ret = Line[Index];
        Index++;
        return ret;
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public string[] StringArray()
    {
        Line = Console.ReadLine().Split(Separator);
        Index = Line.Length;
        return Line;
    }

    public int[] IntArray()
    {
        var l = StringArray();
        var res = new int[l.Length];
        for (int i = 0; i < l.Length; i++)
        {
            res[i] = int.Parse(l[i]);
        }
        return res;
    }

    public long[] LongArray()
    {
        var l = StringArray();
        var res = new long[l.Length];
        for (int i = 0; i < l.Length; i++)
        {
            res[i] = long.Parse(l[i]);
        }
        return res;
    }
}
class Program
{
    private string S;
    private void Scan()
    {
        var sc = new Scanner();
        S = sc.Next();
    }

    public void Solve()
    {
        Scan();
        var cnt = new int[200];
        foreach (char c in S)
        {
            cnt[c]++;
        }
        int one = 0;
        string s = "";
        for (char c = 'a'; c <= 'z'; c++)
        {
            var i = cnt[c];
            if (i == 1)
            {
                s = c.ToString();
                one++;
            }
            if (i >= 3)
            {
                Console.WriteLine("Impossible");
                return;
            }

        }
        Console.WriteLine(one == 1 ? s : "Impossible");
    }

    static void Main(string[] args)
    {
        new Program().Solve();
    }
}
0