| ||||||||||
| 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 | |||||||||
贴AC代码 欢迎围观来段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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator