Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
k-tree 431 C
#include<bits/stdc++.h> using namespace std; #define ll long long #define M 1000000007 #define ff first #define ss second #define mp make_pair #define pb push_back #define io ios_base::sync_with_stdio(false);cin.tie(NULL); #define loop(i,a,n) for(int i=a;i<n;i++) #define trav(a,x) for(auto &a:x) #define vi vector<int> #define vl vector<ll> #define pii pair<ll,ll> #define w 1e5 int n,k,d; vector<vector<ll>>dp; int fun(int maxd,int u) { if(u==0 && maxd>=d) return 1; if(u<0) return 0; ll ans=0; loop(i,1,k+1) { ans=(ans+(fun(max(i,maxd),u-i))%M)%M; } return ans; } void solve() { cin>>n>>k>>d; dp.assign(1001,vector<ll>(1001,-1)); ll x=fun(0,n); // cout<<dp[n][1]; cout<<x; } int main() { // your code goes here io; // int t ; // cin>>t; // while(t--) solve(); return 0; }
run
|
edit
|
history
|
help
0
Prime calculator using bool
Conjuntos - Comparar cantidad de elementos únicos en 2 vectores
Weighted Index
Sekhejane link
test if nullptr
Zadanie Kolokwium_2011_z4
grid
P1
Network UVa
sdefrgthyjukiujyhtg