Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

dp........

Posted by shoutz at 2013-07-15 10:43:51 on Problem 1664
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
int main()
{
    int a;
    cin>>a;
    while(a--)
    {
        int b,c;
        cin>>b>>c;
        int d[20][20];

        for(int i=0;i<20;i++)
            for(int j=0;j<20;j++)
                d[i][j]=1;
        for(int i=2;i<=c;i++)
            for(int j=2;j<=b;j++)
        {
            if(j<i)
                d[j][i]=d[j][i-1];
            else
            d[j][i]=d[j][i-1]+d[j-i][i];
        }
        cout<<d[b][c]<<endl;

    }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator