結果

問題 No.398 ハーフパイプ(2)
ユーザー mbanmban
提出日時 2017-01-10 20:18:27
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 2,661 bytes
コンパイル時間 2,663 ms
コンパイル使用メモリ 106,052 KB
実行使用メモリ 184,884 KB
最終ジャッジ日時 2023-09-09 23:15:17
合計ジャッジ時間 37,670 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.IO;


class Magatro
{
    static Scanner sc = new Scanner('.');
    static int X;
    static long[] dp = new long[6 * 101 * 101 * 601];
    static void Main()
    {
        Read();
        for(int i = 0; i <= 100; i++)
        {
            dp[Converter(0, i, i, i)] = 1;
        }

        for(int i = 1; i < 6; i++)
        {
            for(int min = 0; min <= 100; min++)
            {
                for (int max = min; max <= 100; max++)
                {
                    for(int sum = i * min; sum <= max * i; sum++)
                    {
                        if (dp[Converter(i - 1, min, max, sum)] == 0)
                        {
                            continue;
                        }
                        for(int j = 0; j <= 100; j++)
                        {
                            dp[Converter(i, Math.Min(j, min), Math.Max(j, max), sum + j)] += dp[Converter(i - 1, min, max, sum)];
                        }
                    }
                }
            }
        }
        long ans = 0;
        for(int min = 0; min <= 100; min++)
        {
            for(int max = min; max <= 100; max++)
            {
                ans += dp[Converter(5, min, max, X + min + max)];
            }
        }
        Console.WriteLine(ans);
    }
    static void Read()
    {
        int a = sc.NextInt();
        int b = sc.NextInt();
        X = 4 * a + b / 25;
    }
    static int Converter(int i,int min,int max,int sum)
    {
        if (i > 5 || min > 100 || max > 100 || sum > 600 || i < 0 || min < 0 || max < 0 || sum < 0)
        {
            throw new Exception();
        }
        return i * (101 * 101 * 601) + min * (101 * 601) + max * 601 + sum;
    }
}

public class Scanner
{
    public 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