結果
問題 | No.189 SUPER HAPPY DAY |
ユーザー | mkawa2 |
提出日時 | 2020-01-27 23:02:24 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,831 bytes |
コンパイル時間 | 83 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 56,960 KB |
最終ジャッジ日時 | 2024-09-14 16:33:26 |
合計ジャッジ時間 | 10,547 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
10,880 KB |
testcase_01 | AC | 36 ms
11,136 KB |
testcase_02 | AC | 32 ms
10,880 KB |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | WA | - |
testcase_06 | RE | - |
testcase_07 | WA | - |
testcase_08 | RE | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | RE | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | RE | - |
testcase_18 | WA | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | RE | - |
testcase_25 | AC | 2,671 ms
56,960 KB |
ソースコード
class mint: def __init__(self, x): self.__x = x % md def __str__(self): return str(self.__x) def __add__(self, other): if isinstance(other, mint): other = other.__x return mint(self.__x + other) def __sub__(self, other): if isinstance(other, mint): other = other.__x return mint(self.__x - other) def __rsub__(self, other): return mint(other - self.__x) def __mul__(self, other): if isinstance(other, mint): other = other.__x return mint(self.__x * other) __radd__ = __add__ __rmul__ = __mul__ def __truediv__(self, other): if isinstance(other, mint): other = other.__x return mint(self.__x * pow(other, md - 2, md)) def __pow__(self, power, modulo=None): return mint(pow(self.__x, power, md)) md = 10 ** 9 + 9 def main(): m, d = input().split() m = [int(c) for c in m] d = [int(c) for c in d] dpm = [[0 for _ in range(1801)] for _ in range(len(m) + 1)] dpd = [[0 for _ in range(1801)] for _ in range(len(d) + 1)] border = 0 for i, a in enumerate(m): for s in range(1801): pre = dpm[i][s] if pre == 0: continue for na in range(10): dpm[i + 1][s + na] += pre for na in range(a): dpm[i + 1][border + na] += mint(1) border += a dpm[-1][border] += 1 border = 0 for i, a in enumerate(m): for s in range(1801): pre = dpd[i][s] if pre == 0: continue for na in range(10): dpd[i + 1][s + na] += pre for na in range(a): dpd[i + 1][border + na] += mint(1) border += a dpd[-1][border] += 1 ans = sum(dpm[-1][i] * dpd[-1][i] for i in range(1, 1801)) print(ans) main()