結果

問題 No.269 見栄っ張りの募金活動
ユーザー dsrkuymdsrkuym
提出日時 2020-04-16 10:01:00
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,366 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 85,408 KB
最終ジャッジ日時 2024-04-09 19:07:50
合計ジャッジ時間 1,185 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp:20:9: error: 'uint64_t' does not name a type
   20 | typedef uint64_t u64;
      |         ^~~~~~~~
main.cpp:17:1: note: 'uint64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
   16 | #include <numeric>
  +++ |+#include <cstdint>
   17 | 
main.cpp:22:9: error: 'uint32_t' does not name a type
   22 | typedef uint32_t u32;
      |         ^~~~~~~~
main.cpp:22:9: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
main.cpp:25:16: error: 'u32' was not declared in this scope; did you mean 's32'?
   25 | typedef vector<u32> vu32;
      |                ^~~
      |                s32
main.cpp:25:19: error: template argument 1 is invalid
   25 | typedef vector<u32> vu32;
      |                   ^
main.cpp:25:19: error: template argument 2 is invalid
main.cpp:27:16: error: 'u64' was not declared in this scope; did you mean 's64'?
   27 | typedef vector<u64> vu64;
      |                ^~~
      |                s64
main.cpp:27:19: error: template argument 1 is invalid
   27 | typedef vector<u64> vu64;
      |                   ^
main.cpp:27:19: error: template argument 2 is invalid

ソースコード

diff #

#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;
    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;
}

0