結果

問題 No.189 SUPER HAPPY DAY
ユーザー tentententen
提出日時 2020-12-29 01:47:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 886 bytes
コンパイル時間 2,049 ms
コンパイル使用メモリ 77,904 KB
実行使用メモリ 54,752 KB
最終ジャッジ日時 2024-04-15 01:22:00
合計ジャッジ時間 7,032 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
54,024 KB
testcase_01 AC 149 ms
54,256 KB
testcase_02 AC 125 ms
54,252 KB
testcase_03 AC 145 ms
54,392 KB
testcase_04 AC 139 ms
53,956 KB
testcase_05 AC 140 ms
54,076 KB
testcase_06 AC 133 ms
54,224 KB
testcase_07 AC 144 ms
54,060 KB
testcase_08 AC 143 ms
53,892 KB
testcase_09 AC 140 ms
53,992 KB
testcase_10 AC 146 ms
54,244 KB
testcase_11 AC 134 ms
54,072 KB
testcase_12 AC 147 ms
54,144 KB
testcase_13 AC 161 ms
54,124 KB
testcase_14 AC 152 ms
54,200 KB
testcase_15 AC 155 ms
54,248 KB
testcase_16 AC 141 ms
54,228 KB
testcase_17 AC 176 ms
54,752 KB
testcase_18 AC 167 ms
54,376 KB
testcase_19 AC 155 ms
54,436 KB
testcase_20 AC 150 ms
54,472 KB
testcase_21 AC 155 ms
54,168 KB
testcase_22 AC 144 ms
54,160 KB
testcase_23 AC 143 ms
54,140 KB
testcase_24 AC 163 ms
54,364 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static final int MOD = 1000000009;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] mdp = getDP(sc.next().toCharArray());
		int[] ddp = getDP(sc.next().toCharArray());
		long ans = 0;
		for (int i = 1; i < 1800; i++) {
		    ans += (long)mdp[i] * ddp[i] % MOD;
		    ans %= MOD;
		}
		System.out.println(ans);
	}
	
	static int[] getDP(char[] arr) {
	    int[] dp = new int[1800];
	    int sum = 0;
	    for (int i = 0; i < arr.length; i++) {
	        for (int j = dp.length - 10; j >= 0; j--) {
	            for (int k = 1; k < 10; k++) {
	                dp[j + k] += dp[j];
	                dp[j + k] %= MOD;
	            }
	        }
	        for (int j = 0; j < arr[i] - '0'; j++) {
	            dp[sum + j]++;
	        }
	        sum += arr[i] - '0';
	    }
	    dp[sum]++;
	    return dp;
	}
}
0