結果

問題 No.437 cwwゲーム
ユーザー eitaho
提出日時 2016-10-28 22:31:04
言語 C#
(csc 3.100.19.26603)
結果
AC  
実行時間 39 ms
コード長 2,689 Byte
コンパイル時間 1,648 ms
使用メモリ 17,984 KB
最終ジャッジ日時 2019-10-07 05:37:49

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
00_sample01.txt AC 30 ms
17,984 KB
00_sample02.txt AC 28 ms
13,892 KB
00_sample03.txt AC 29 ms
15,936 KB
01_hand01.txt AC 29 ms
13,908 KB
01_hand02.txt AC 30 ms
17,984 KB
01_hand03.txt AC 29 ms
15,940 KB
01_hand04.txt AC 30 ms
17,980 KB
01_hand05.txt AC 36 ms
13,900 KB
01_hand06.txt AC 30 ms
13,908 KB
01_hand07.txt AC 36 ms
13,888 KB
01_hand08.txt AC 35 ms
15,936 KB
01_hand09.txt AC 29 ms
17,980 KB
01_hand10.txt AC 30 ms
15,940 KB
01_hand11.txt AC 29 ms
13,912 KB
01_hand12.txt AC 30 ms
15,940 KB
01_hand13.txt AC 39 ms
15,948 KB
01_hand14.txt AC 30 ms
17,984 KB
01_hand15.txt AC 29 ms
15,948 KB
99_system_test1.txt AC 29 ms
13,908 KB
challenge01.txt AC 30 ms
15,944 KB
challenge02.txt AC 28 ms
13,904 KB
in01.txt AC 29 ms
15,940 KB
in02.txt AC 29 ms
15,936 KB
in03.txt AC 28 ms
13,896 KB
in04.txt AC 28 ms
11,860 KB
in05.txt AC 30 ms
15,932 KB
in06.txt AC 29 ms
15,936 KB
in07.txt AC 29 ms
15,932 KB
in08.txt AC 29 ms
15,940 KB
in09.txt AC 29 ms
13,896 KB
in10.txt AC 29 ms
15,932 KB
in11.txt AC 28 ms
13,888 KB
in12.txt AC 29 ms
13,900 KB
in13.txt AC 29 ms
15,932 KB
in14.txt AC 29 ms
17,984 KB
in15.txt AC 29 ms
15,940 KB
in16.txt AC 29 ms
15,940 KB
in17.txt AC 29 ms
13,896 KB
in18.txt AC 29 ms
13,892 KB
in19.txt AC 31 ms
17,980 KB
in20.txt AC 29 ms
13,888 KB
system_test1.txt AC 29 ms
15,948 KB
system_test2.txt AC 29 ms
13,908 KB
system_test3.txt AC 31 ms
17,984 KB
テストケース一括ダウンロード
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.100.19.26603 (9d80dea7)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Diagnostics;
using Enu = System.Linq.Enumerable;
using System.Numerics;

public class Program
{
    long ans = 0;

    public void Solve()
    {
        var S = Reader.String();
        Rec(S, 0);
        Console.WriteLine(ans);
    }

    private void Rec(string S, long score)
    {
        ans = Math.Max(ans, score);
        for (int a = 0; a < S.Length; a++)
            if (S[a] != '0')
                for (int b = a + 1; b < S.Length; b++)
                    if (S[a] != S[b])
                        for (int c = b + 1; c < S.Length; c++)
                            if (S[b] == S[c])
                                Rec(S.Remove(c, 1).Remove(b, 1).Remove(a, 1),
                                    score + (S[a] - '0') * 100 + (S[b] - '0') * 11);
    }

}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    static string[] Split(string s) { return s.Split(separator, op); }
    static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}
0