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

帮帮忙,大哥大姐们.就是交不了!!!郁闷了!

Posted by 00448166 at 2005-03-06 22:16:15 on Problem 1664
#include <iostream.h>

int num(int m,int n,int min)
{
	int i;
	if(m==0)
		return 1;
	if(n==1)
		return 1;
	int j=0;
	for(i=min;i<=m;i++)
	{
		if((m-i)>=i||(m-i)==0)
			 j=j+num(m-i,n-1,i);
	}
	return j;
}
int main()
{
	int a[20];
	int b[20];
	int times;
	cout<<"input times:"<<endl;
	cin>>times;
	int i;
	cout<<"input m , n:"<<endl;
	for(i=0;i<times;i++)
	{
		cin>>a[i]>>b[i];
	}
	for(i=0;i<times;i++)
	{
		cout<<num(a[i],b[i],1)<<endl;
	}
	return 0;
}
		

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