結果

問題 No.189 SUPER HAPPY DAY
ユーザー mbanmban
提出日時 2017-09-23 10:26:58
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 167 ms / 5,000 ms
コード長 1,459 bytes
コンパイル時間 1,113 ms
コンパイル使用メモリ 111,548 KB
実行使用メモリ 33,316 KB
最終ジャッジ日時 2024-04-26 15:19:16
合計ジャッジ時間 3,518 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
25,956 KB
testcase_01 AC 26 ms
23,712 KB
testcase_02 AC 25 ms
23,844 KB
testcase_03 AC 26 ms
23,724 KB
testcase_04 AC 27 ms
25,880 KB
testcase_05 AC 26 ms
24,104 KB
testcase_06 AC 26 ms
23,716 KB
testcase_07 AC 26 ms
24,092 KB
testcase_08 AC 25 ms
23,832 KB
testcase_09 AC 25 ms
22,056 KB
testcase_10 AC 26 ms
23,836 KB
testcase_11 AC 26 ms
23,980 KB
testcase_12 AC 26 ms
26,132 KB
testcase_13 AC 65 ms
27,572 KB
testcase_14 AC 81 ms
27,124 KB
testcase_15 AC 88 ms
30,796 KB
testcase_16 AC 98 ms
27,464 KB
testcase_17 AC 102 ms
30,296 KB
testcase_18 AC 83 ms
28,608 KB
testcase_19 AC 107 ms
29,180 KB
testcase_20 AC 48 ms
24,924 KB
testcase_21 AC 45 ms
25,688 KB
testcase_22 AC 28 ms
26,332 KB
testcase_23 AC 100 ms
33,316 KB
testcase_24 AC 98 ms
29,220 KB
testcase_25 AC 167 ms
32,820 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;

class Program
{
    readonly int Max=2000;
    readonly int Mod=1000000009;
    private long[]Calc(string s)
    {
        var dp1=new long[Max,s.Length+1];
        var dp2=new long[Max,s.Length+1];
        dp1[0,0]=1;
        dp2[0,0]=1;
        for(int i=1;i<=s.Length;i++)
        {
            int index=s.Length-i;
            for(int k=0;k<=9*(i-1);k++)
            {
                for(int j=0;j<=9;j++)
                {
                    dp1[k+j,i]+=dp1[k,i-1];
                    if(s[index]-'0'==j)
                    {
                        dp2[k+j,i]+=dp2[k,i-1];
                    }
                    else if(s[index]-'0'>j)
                    {
                        dp2[k+j,i]+=dp1[k,i-1];
                    }
                    dp1[k+j,i]%=Mod;
                    dp2[k+j,i]%=Mod;
                }
            }
        }
        var res=new long[Max];
        for(int i=0;i<Max;i++)
        {
            res[i]=dp2[i,s.Length];
        }
        return res;
    }
    
    public void Solve()
    {
        var l=Console.ReadLine().Split(' ');
        var m=Calc(l[0]);
        var d=Calc(l[1]);
        long ans=0;
        for(int i=1;i<Max;i++)
        {
            ans+=(m[i]*d[i])%Mod;
            ans%=Mod;
        }
        Console.WriteLine(ans);
    } 
    
    static void Main()
    {
        new Program().Solve();
    }
}
0