結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
|
提出日時 | 2016-12-28 20:26:49 |
言語 | D (dmd 2.109.1) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 925 bytes |
コンパイル時間 | 977 ms |
コンパイル使用メモリ | 107,136 KB |
実行使用メモリ | 18,048 KB |
最終ジャッジ日時 | 2024-06-12 06:09:47 |
合計ジャッジ時間 | 18,693 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 TLE * 1 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;import std.typecons, std.range, std.random, std.math, std.container;import std.numeric, std.bigint, core.bitop, core.stdc.stdio;void main() {immutable long MOD = 10^^9+7;int N, S, K;scanf("%d %d %d", &N, &S, &K);auto dp = new long[][](N, S+1);foreach (i; 0..N) foreach (j; 0..S+1) dp[i][j] = 0;foreach (i; 0..S+1) {auto s = N * (N-1) * K / 2 + i * N;if (s > S)break;dp[0][s] = 1;}foreach (i; 0..N-1) {foreach (j; 0..S+1) {if (dp[i][j] == 0)continue;foreach (x; 0..S+1) { // (i+1)人目が(K+x)円増やすauto incr = (N-i-1) * x;if (j + incr > S)break;(dp[i+1][j+incr] += dp[i][j]) %= MOD;}}}dp[N-1][S].writeln;}