結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
|
提出日時 | 2018-09-03 23:07:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 5,000 ms |
コード長 | 525 bytes |
コンパイル時間 | 1,501 ms |
コンパイル使用メモリ | 166,772 KB |
実行使用メモリ | 18,916 KB |
最終ジャッジ日時 | 2024-07-16 02:07:41 |
合計ジャッジ時間 | 2,389 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<bits/stdc++.h>#pragma warning(disable:4996)using namespace std;using ll = long long;const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };ll dp[101][20002];const int M = 1e9 + 7;int main() {int N, S, K;cin >> N >> S >> K;dp[0][0] = 1;for (int i = 1; i <= N;i++) {for (int j = 0; j <= S - (N * (N - 1)*K / 2);j++) {if (j - i >= 0) {dp[i][j] = (dp[i - 1][j] + dp[i][j - i])%M;}else {dp[i][j] = dp[i - 1][j]%M;}}}cout << dp[N][S - ((N * (N - 1)*K) / 2)] << endl;}