結果

問題 No.437 cwwゲーム
ユーザー mbanmban
提出日時 2017-01-09 22:15:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 2,216 bytes
コンパイル時間 2,182 ms
コンパイル使用メモリ 107,676 KB
実行使用メモリ 23,668 KB
最終ジャッジ日時 2023-08-02 13:08:51
合計ジャッジ時間 6,394 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
21,576 KB
testcase_01 AC 51 ms
21,180 KB
testcase_02 AC 57 ms
21,444 KB
testcase_03 AC 57 ms
23,572 KB
testcase_04 AC 57 ms
21,692 KB
testcase_05 AC 57 ms
21,484 KB
testcase_06 AC 58 ms
23,608 KB
testcase_07 AC 62 ms
21,580 KB
testcase_08 AC 59 ms
23,584 KB
testcase_09 AC 63 ms
23,580 KB
testcase_10 AC 60 ms
21,520 KB
testcase_11 AC 53 ms
21,380 KB
testcase_12 AC 58 ms
21,540 KB
testcase_13 AC 58 ms
21,576 KB
testcase_14 AC 57 ms
21,520 KB
testcase_15 AC 64 ms
21,476 KB
testcase_16 AC 57 ms
21,560 KB
testcase_17 AC 58 ms
21,524 KB
testcase_18 AC 58 ms
23,580 KB
testcase_19 AC 56 ms
19,416 KB
testcase_20 AC 57 ms
21,472 KB
testcase_21 AC 57 ms
21,536 KB
testcase_22 AC 58 ms
21,552 KB
testcase_23 AC 58 ms
21,588 KB
testcase_24 AC 58 ms
21,492 KB
testcase_25 AC 57 ms
23,552 KB
testcase_26 AC 57 ms
19,620 KB
testcase_27 AC 52 ms
21,188 KB
testcase_28 AC 59 ms
21,492 KB
testcase_29 AC 52 ms
21,188 KB
testcase_30 AC 54 ms
23,392 KB
testcase_31 AC 53 ms
23,392 KB
testcase_32 AC 54 ms
23,272 KB
testcase_33 AC 61 ms
23,568 KB
testcase_34 AC 61 ms
21,480 KB
testcase_35 AC 59 ms
21,556 KB
testcase_36 AC 56 ms
23,204 KB
testcase_37 AC 57 ms
21,348 KB
testcase_38 AC 62 ms
23,668 KB
testcase_39 AC 56 ms
21,216 KB
testcase_40 AC 61 ms
21,436 KB
testcase_41 AC 60 ms
19,600 KB
testcase_42 AC 60 ms
21,536 KB
testcase_43 AC 61 ms
21,532 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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;


class Magatro
{
    static string N = Console.ReadLine();
 static void Main()
    {
        bool[] boolean = new bool[N.Length];
        Console.WriteLine(cnt(boolean));
    }
    static int cnt(bool[] b)
    {
        bool flag = false;
        int max = 0;
        for(int i = 0; i < N.Length-2; i++)
        {
            if (b[i]||N[i]=='0')
            {
                continue;
            }
            for(int j = i + 1; j < N.Length - 1; j++)
            {
                if (b[j] || N[i] == N[j])
                {
                    continue;
                }
                for(int k = j + 1; k < N.Length; k++)
                {
                    if (b[k] || N[k] != N[j])
                    {
                        continue;
                    }
                    flag = true;
                    int ans = int.Parse(new string(new char[] { N[i], N[j], N[k] }));
                    bool[] copy = b.ToArray();
                    copy[i] = true;
                    copy[j] = true;
                    copy[k] = true;
                    max = Math.Max(max, cnt(copy)+ans);
                }
            }
        }
        if (flag)
        {
            return max;
        }
        else
        {
            return 0;
        }
    }
}
public class Scanner
{
    private string[] S;
    private int Index;
    private char Separator;
    public Scanner(char separator=' ')
    {
        Index = 0;
        Separator = separator;
    }
    public string Next()
    {
        string result;
        if (S == null || Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    private string[] Line()
    {
        return Console.ReadLine().Split(Separator);
    } 
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
}
0