結果

問題 No.269 見栄っ張りの募金活動
ユーザー MoriMori
提出日時 2019-11-28 04:02:33
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 1,131 bytes
コンパイル時間 1,115 ms
コンパイル使用メモリ 157,540 KB
実行使用メモリ 818,048 KB
最終ジャッジ日時 2024-04-28 06:58:57
合計ジャッジ時間 3,877 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>

#define fir first
#define sec second
#define get(n) scanf("%d",&n);
#define gets(s) string s;cin >> (s);
#define All(s) (c).begin(), (c).end()
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);
#define rep(i, j) for (int (i)=0;(i)<(j);(i)++)
#define repk(i, j, k) for(int (i)=(j);(i)<(k);(i)++)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long int ll;
const ll INF = 10241024;
const int MA = 1e9 + 7;
int N,S,K;
void input(){
    cin >> N >> S >> K;
}
int getcomb(int i, int sum){//when student(i) determine amount, then sum means sum of amount of money of prev stu's
    if(i == 0 && sum == 0)return 1;
    if(sum == 0 && i == 1) return K;
    int a = getcomb(i-1, sum-K*(N-i)) + getcomb(i-1, sum-(N - 1));
    return a;
}
void solve(){
    input();
    int ans = getcomb(N, S);
    cout << ans << endl;
}

int main () {
    solve();
    return 0;
}


0