| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:本题是很简单的递推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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator