結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-05 22:07:00 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 4,307 bytes |
| コンパイル時間 | 2,002 ms |
| コンパイル使用メモリ | 197,832 KB |
| 最終ジャッジ日時 | 2025-02-09 23:19:48 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 16 WA * 1 RE * 5 |
ソースコード
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>//
//#include<ext/pb_ds/tree_policy.hpp>//
using namespace std;
//using namespace __gnu_pbds;//
#define int long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr); cout.tie(nullptr);
#define endl '\n'
#define fo(i,x,n) for(int i=x; i<=n;i++)
#define rfo(i,n,x) for(int i=n; i>=x;i--)
#define kill(x) cout<<x<<endl;continue;
#define OUTPUT(x) cout << (x ? "YES" : "NO")<<endl;
#define Output(x) cout << (x ? "Yes" : "No")<<endl;
#define output(x) cout << (x ? "yes" : "no")<<endl;
#define minv(v) *min_element(v.begin(), v.end())
#define maxv(v) *max_element(v.begin(), v.end())
#define sumv(v) accumulate(v.begin(), v.end(), 0LL)
#define print(v) for(auto k : v) cout<<k<<" "
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define p1(x) cout<<x<<endl
#define p2(x,y) cout<<x<<" "<<y<<endl
#define p3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define vii vector<ii>
#define vi vector<int>
#define vvi vector<vector<int>>
#define mod 1000000007
#define FILL(x,v) memset(x, v, sizeof(x))
#define PI 3.14159265358979323846
#define INF LLONG_MAX //9.223372e+18
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;//
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " " << x << endl;
#else
#define debug(x)
#endif
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(double t) {cerr << t;}
template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
int gcd(int a,int b){
return (b==0) ? a : gcd(b,a%b);
}
int32_t main(){
fastio
//cout<<setprecision(6)<<fixed<<ans<<endl;//
//freopen( "input.txt" , "r" , stdin );//
//freopen( "output.txt" , "w" , stdout );//
// jaldi_karenge_jaldbaazi_nahi
int t=1;
// cin>>t;
while(t--){
int n,s,k;
cin>>n>>s>>k;
// P(S−(K+2K+⋯+(N- 1) K), N).
int q = (n*(n-1))/2;
q*=k;
s -= q;
vector<vector<int>> dp(s+1,vector<int> (n+1,0));
dp[0][0] = 1;
fo(i,1,s){
fo(j,1,n){
dp[i][j] += dp[i-1][j-1];
dp[i][j] %=mod;
if(i>=j){
dp[i][j] += dp[i-j][j];
dp[i][j] %=mod;
}
}
}
int ans = 0 ;
fo(i,1,n){
ans += dp[s][i];
ans %= mod;
}
cout<<ans<<endl;
// cout<<dp[s][n]<<endl;
}
return 0;
}