結果

問題 No.437 cwwゲーム
ユーザー eitahoeitaho
提出日時 2016-10-28 22:31:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 2,689 bytes
コンパイル時間 3,179 ms
コンパイル使用メモリ 107,032 KB
実行使用メモリ 22,628 KB
最終ジャッジ日時 2023-08-02 12:50:29
合計ジャッジ時間 6,688 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
22,528 KB
testcase_01 AC 52 ms
22,536 KB
testcase_02 AC 51 ms
20,556 KB
testcase_03 AC 51 ms
20,512 KB
testcase_04 AC 51 ms
20,488 KB
testcase_05 AC 52 ms
20,496 KB
testcase_06 AC 53 ms
22,596 KB
testcase_07 AC 54 ms
20,500 KB
testcase_08 AC 53 ms
20,496 KB
testcase_09 AC 55 ms
20,512 KB
testcase_10 AC 54 ms
22,628 KB
testcase_11 AC 52 ms
20,568 KB
testcase_12 AC 52 ms
20,556 KB
testcase_13 AC 52 ms
20,616 KB
testcase_14 AC 50 ms
20,624 KB
testcase_15 AC 54 ms
20,504 KB
testcase_16 AC 52 ms
20,560 KB
testcase_17 AC 52 ms
20,440 KB
testcase_18 AC 51 ms
20,572 KB
testcase_19 AC 52 ms
20,500 KB
testcase_20 AC 53 ms
20,560 KB
testcase_21 AC 51 ms
20,560 KB
testcase_22 AC 53 ms
20,472 KB
testcase_23 AC 52 ms
20,512 KB
testcase_24 AC 52 ms
18,568 KB
testcase_25 AC 52 ms
20,556 KB
testcase_26 AC 51 ms
20,484 KB
testcase_27 AC 52 ms
20,580 KB
testcase_28 AC 51 ms
20,564 KB
testcase_29 AC 52 ms
22,520 KB
testcase_30 AC 50 ms
22,528 KB
testcase_31 AC 51 ms
20,580 KB
testcase_32 AC 51 ms
22,608 KB
testcase_33 AC 52 ms
20,500 KB
testcase_34 AC 52 ms
20,492 KB
testcase_35 AC 53 ms
20,692 KB
testcase_36 AC 52 ms
20,592 KB
testcase_37 AC 51 ms
20,564 KB
testcase_38 AC 52 ms
20,500 KB
testcase_39 AC 53 ms
18,456 KB
testcase_40 AC 51 ms
20,484 KB
testcase_41 AC 50 ms
20,596 KB
testcase_42 AC 51 ms
20,496 KB
testcase_43 AC 52 ms
20,448 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.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