結果
| 問題 |
No.41 貯金箱の溜息(EASY)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-03 15:08:13 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 5,000 ms |
| コード長 | 768 bytes |
| コンパイル時間 | 1,171 ms |
| コンパイル使用メモリ | 117,248 KB |
| 実行使用メモリ | 5,760 KB |
| 最終ジャッジ日時 | 2024-06-12 04:08:16 |
| 合計ジャッジ時間 | 1,473 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 |
ソースコード
import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.conv, std.stdio, std.typecons;
const auto mod = 10 ^^ 9 + 9;
void main()
{
auto t = readln.chomp.to!int;
auto mi = iota(t).map!(_ => readln.chomp.to!long);
auto ni = mi.map!(m => (m / 111111).to!int).array;
auto maxN = ni.reduce!(max);
auto memo = new int[](maxN + 1);
memo[] = 1;
foreach (i; 1..10) {
auto memo2 = new int[](maxN + 1);
foreach (j; 0..maxN + 1) {
memo2[j] = (memo[j] + (j >= i ? memo2[j - i] : 0)) % mod;
}
foreach (j; 0..maxN + 1) {
memo[j] = (memo[j] + (j >= i ? memo2[j - i] : 0)) % mod;
}
}
foreach (n; ni)
writeln(memo[n]);
}