結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
![]() |
提出日時 | 2019-08-08 16:14:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 69 ms / 5,000 ms |
コード長 | 3,771 bytes |
コンパイル時間 | 1,151 ms |
コンパイル使用メモリ | 102,860 KB |
最終ジャッジ日時 | 2025-01-07 11:01:27 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
/* ∧_∧ やあ (´・ω・`) / ようこそ、バーボンハウスへ。 /∇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; }