結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-16 10:00:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,399 bytes |
| コンパイル時間 | 969 ms |
| コンパイル使用メモリ | 92,688 KB |
| 実行使用メモリ | 19,200 KB |
| 最終ジャッジ日時 | 2024-10-01 19:10:54 |
| 合計ジャッジ時間 | 1,513 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 5 WA * 17 |
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>
using namespace std;
typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;
const double PI=3.14159265358979323846;
#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))
#define rep(i, N) for(int i = 0; i < N; ++i)
#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL
#define IN(l, r, x) ((l) <= (x) && (x) < (r))
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int n, s, k;
cin >> n >> s >> k;
if (s < n * (n - 1) * k / 2)
{
cout << "0\n";
return 0;
}
int m = s - n * (n - 1) * k / 2;
cout << "m = " << m << "\n";
s64 dp[n + 1][m + 1];
rep (i, n + 1) rep (j, m + 1) dp[i][j] = 0;
dp[0][0] = 1;
for (int i = 1; i <= n; ++i)
{
rep (j, m + 1)
{
if (j - i >= 0) dp[i][j] = (dp[i][j - i] + dp[i - 1][j]) % MOD;
else dp[i][j] = dp[i - 1][j];
}
}
cout << dp[n][m] << "\n";
return 0;
}