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

贴AC代码 欢迎围观

Posted by 97xiao at 2009-10-26 00:05:52 on Problem 1664
来段AD 团队搞了个电影网 有兴趣一起看 www.haokan5.com 嘎嘎 AC了
#include<iostream>
using namespace std;
int f(int m,int n)
{
	int result=0,i;
	if(n==1||m==n)
		return 1;
	else if(n>m)
		return 0;
	else 
	{
		for(i=1;i<=n;i++)
		{
			result+=f(m-n,i);
		}
		return result;
	}
}
int main()
{
	int t,m,n,i,result;
	cin>>t;
	while(t--)
	{
		result=0;
		cin>>m>>n;
		for(i=1;i<=n;i++)
		{
			result+=f(m,i);
		}
		cout<<result<<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