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 wyu_Single at 2009-07-27 21:27:55 on Problem 1664
In Reply To:Re:本题是很简单的递推 Posted by:bingdian at 2009-05-26 21:29:03
我怎么 超内存啊。。。。#include<iostream>
using namespace std;
int main()
{
	int m,n,t;
	int fun(int,int);
	cin>>t;
	while(t--)
	{
		cin>>m>>n;
		cout<<fun(m,n)<<endl;
	}
	return 0;
}
int fun(int m,int n)
{
	int f;
	if(m==0||m==1) f=1;
	else
		if(n==0||n==1) f=1;
		else
			f=fun(m-n,n)+fun(m,n-1);
		return f;
}

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