Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int INF = 1e9;
- int dp1[10001],dp2[10001];
- int main(){
- int n,k;
- scanf("%d%d",&n,&k);
- for(int i=0;i<=n;i++){
- for(int j=0;j<=k;j++){
- if(j == 0) dp2[j] = 1;
- if(j == 0 or i == 0) continue;
- for(int x=0;x<i;x++){
- if(j-x >=0 ) dp2[j] += dp1[j-x];
- }
- dp2[j] = dp2[j]%2012;
- }
- for(int j=0;j<=k;j++) {
- dp1[j] = dp2[j];
- dp2[j] = 0;
- }
- }
- printf("%d",dp1[k]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement