結果

問題 No.189 SUPER HAPPY DAY
ユーザー mbanmban
提出日時 2017-09-23 10:26:58
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 201 ms / 5,000 ms
コード長 1,459 bytes
コンパイル時間 2,302 ms
コンパイル使用メモリ 105,716 KB
実行使用メモリ 33,864 KB
最終ジャッジ日時 2023-08-08 23:09:07
合計ジャッジ時間 5,716 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
20,536 KB
testcase_01 AC 51 ms
20,552 KB
testcase_02 AC 51 ms
20,512 KB
testcase_03 AC 52 ms
22,660 KB
testcase_04 AC 52 ms
22,632 KB
testcase_05 AC 51 ms
20,508 KB
testcase_06 AC 51 ms
20,592 KB
testcase_07 AC 52 ms
20,532 KB
testcase_08 AC 53 ms
18,600 KB
testcase_09 AC 53 ms
20,636 KB
testcase_10 AC 52 ms
20,592 KB
testcase_11 AC 51 ms
20,580 KB
testcase_12 AC 53 ms
22,616 KB
testcase_13 AC 93 ms
24,428 KB
testcase_14 AC 106 ms
24,120 KB
testcase_15 AC 112 ms
26,464 KB
testcase_16 AC 127 ms
28,020 KB
testcase_17 AC 129 ms
26,924 KB
testcase_18 AC 110 ms
25,664 KB
testcase_19 AC 129 ms
28,040 KB
testcase_20 AC 75 ms
21,684 KB
testcase_21 AC 72 ms
22,600 KB
testcase_22 AC 53 ms
21,248 KB
testcase_23 AC 120 ms
24,032 KB
testcase_24 AC 126 ms
25,904 KB
testcase_25 AC 201 ms
33,864 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