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

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

Posted by chgsh8089 at 2006-03-03 02:12:30 on Problem 1664
In Reply To:帮帮忙,大哥大姐们.就是交不了!!!郁闷了! Posted by:00448166 at 2005-03-06 22:16:15
新手:不是大哥大姐们.
#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