結果

問題 No.189 SUPER HAPPY DAY
ユーザー mbanmban
提出日時 2017-09-23 10:24:45
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,379 bytes
コンパイル時間 2,089 ms
コンパイル使用メモリ 103,636 KB
実行使用メモリ 31,408 KB
最終ジャッジ日時 2023-08-08 23:08:39
合計ジャッジ時間 5,170 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
20,572 KB
testcase_01 AC 53 ms
20,552 KB
testcase_02 AC 52 ms
20,552 KB
testcase_03 AC 54 ms
22,588 KB
testcase_04 AC 54 ms
22,668 KB
testcase_05 AC 54 ms
24,688 KB
testcase_06 AC 54 ms
22,432 KB
testcase_07 AC 54 ms
22,700 KB
testcase_08 AC 54 ms
18,412 KB
testcase_09 AC 53 ms
20,588 KB
testcase_10 AC 53 ms
20,452 KB
testcase_11 AC 53 ms
20,604 KB
testcase_12 AC 53 ms
20,576 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 78 ms
26,052 KB
testcase_24 AC 80 ms
25,740 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