結果

問題 No.269 見栄っ張りの募金活動
ユーザー 白狐白狐
提出日時 2019-08-08 16:14:24
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 61 ms / 5,000 ms
コード長 3,771 bytes
コンパイル時間 1,123 ms
コンパイル使用メモリ 104,700 KB
実行使用メモリ 20,120 KB
最終ジャッジ日時 2023-09-26 00:35:23
合計ジャッジ時間 2,724 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
19,136 KB
testcase_01 AC 7 ms
19,316 KB
testcase_02 AC 8 ms
19,220 KB
testcase_03 AC 9 ms
19,180 KB
testcase_04 AC 28 ms
20,040 KB
testcase_05 AC 8 ms
19,172 KB
testcase_06 AC 8 ms
19,228 KB
testcase_07 AC 61 ms
20,092 KB
testcase_08 AC 8 ms
19,156 KB
testcase_09 AC 7 ms
19,128 KB
testcase_10 AC 8 ms
19,188 KB
testcase_11 AC 13 ms
19,924 KB
testcase_12 AC 8 ms
19,164 KB
testcase_13 AC 15 ms
19,628 KB
testcase_14 AC 10 ms
20,120 KB
testcase_15 AC 14 ms
19,732 KB
testcase_16 AC 8 ms
19,272 KB
testcase_17 AC 8 ms
19,332 KB
testcase_18 AC 25 ms
19,852 KB
testcase_19 AC 13 ms
19,484 KB
testcase_20 AC 9 ms
19,520 KB
testcase_21 AC 10 ms
20,120 KB
testcase_22 AC 11 ms
19,456 KB
testcase_23 AC 8 ms
19,244 KB
testcase_24 AC 10 ms
19,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
     ∧_∧ やあ
   (´・ω・`)     /     ようこそ、バーボンハウスへ。
   /∇y:::::\    [ ̄]     このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
   |:⊃:|:::::|   |──|
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| うん、「また」なんだ。済まない。
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| ̄   仏の顔もって言うしね、謝って許してもらおうとも思っていない。
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄/|
    ∇ ∇ ∇ ∇   /./|   でも、この提出を見たとき、君は、きっと言葉では言い表せない
    ┴ ┴ ┴ ┴ / /   |   「ときめき」みたいなものを感じてくれたと思う。
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|/    |   殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄     |   そう思って、この提出を投げたんだ。
   (⊆⊇) (⊆⊇) (⊆⊇)  |
     ||   ||  ||  |    じゃあ、判定を聞こうか。
  ./|\ /|\ /|\
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

lint lcm(lint a, lint b) {
    return (a / gcd(a, b)) * b;
}

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

lint p[20001][101];

lint pnum (lint n, lint k){
    if(n < 0 || k <= 0){return 0;}
    else if(n == 0 && k >= 1){return 1;}
    else if(p[n][k] != -1){
        return p[n][k];
    }
    lint tmp = (pnum(n, k-1) % MOD + pnum(n-k, k) % MOD) % MOD;
    p[n][k] = tmp;
    return p[n][k];
}

void solve(lint n, lint s, lint k){
    REP(i, 20001){
        REP(j, 101){
            p[i][j] = -1;
        }
    }
    cout << pnum(s - (n * (n-1)) / 2 * k, n) << endl;
    return;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint n, s, k;
    cin >> n >> s >> k;
    solve(n, s, k);
    return 0;
}
0