結果

問題 No.189 SUPER HAPPY DAY
ユーザー mbanmban
提出日時 2017-09-23 10:24:45
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,379 bytes
コンパイル時間 826 ms
コンパイル使用メモリ 113,104 KB
実行使用メモリ 35,260 KB
最終ジャッジ日時 2024-04-26 15:18:52
合計ジャッジ時間 2,745 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,084 KB
testcase_01 AC 25 ms
23,948 KB
testcase_02 AC 25 ms
23,888 KB
testcase_03 AC 26 ms
26,000 KB
testcase_04 AC 25 ms
23,816 KB
testcase_05 AC 25 ms
23,948 KB
testcase_06 AC 26 ms
25,740 KB
testcase_07 AC 26 ms
26,132 KB
testcase_08 AC 25 ms
23,696 KB
testcase_09 AC 26 ms
23,956 KB
testcase_10 AC 26 ms
25,872 KB
testcase_11 AC 25 ms
23,824 KB
testcase_12 AC 25 ms
24,084 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 50 ms
29,108 KB
testcase_24 AC 49 ms
28,768 KB
testcase_25 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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];
                    }
                }
            }
        }
        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];
            ans%=Mod;
        }
        Console.WriteLine(ans);
    } 
    
    static void Main()
    {
        new Program().Solve();
    }
}
0