結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー mbanmban
提出日時 2016-11-02 05:23:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 1,042 bytes
コンパイル時間 2,050 ms
コンパイル使用メモリ 103,584 KB
実行使用メモリ 26,656 KB
最終ジャッジ日時 2023-08-16 12:33:49
合計ジャッジ時間 2,974 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
22,728 KB
testcase_01 AC 121 ms
26,656 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 Magatro
{
    const int MAX = 100000;
    static int T = int.Parse(Console.ReadLine());
    const int MOD = 1000000009;
    static int[,] dp = new int[10, MAX+1];
    static void Main()
    {
        Calc();
        for (int i = 0; i < T; i++)
        {
            long M = long.Parse(Console.ReadLine());
            Console.WriteLine(cnt(M));
        }
    }
    static long cnt(long m)
    {
        long c = m / 111111;
        long ret = 0;
        ret = dp[9, c];
        return ret;
    }
    static void Calc()
    {
      
       for(int i = 0; i < MAX; i++)
        {
            dp[0, i] = 1;
        }
       for(int i = 1; i <= 9; i++)
        {
            for(int j = 0; j <= MAX; j++)
            {
                dp[i, j] = dp[i - 1, j];
                if (j >= i)
                {
                    dp[i, j] = (dp[i, j] + dp[i, j - i]) % MOD;
                }
            }
        }
    }
}


0