| ||||||||||
| 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:1<=M,N<=10。请问测试数据里有没有M个苹果0个盘子的?这样应该输出多少啊?这个哇了。In Reply To:1<=M,N<=10。请问测试数据里有没有M个苹果0个盘子的?这样应该输出多少啊?这个哇了。 Posted by:neikeda_hewei at 2009-05-05 21:37:59 > #include<iostream>
> using namespace std;
>
> int f(int m,int n);
> int main()
> {
> int M,N,K;
>
> cin>>M>>N;
> K=f(M,N);
> cout<<K<<endl;
> return 0;
> }
> int f(int M,int N)
> {
> if(M<0)
> return 0;
> if(M==0||N==1)
> return 1;
> return f(M-N,N)+f(M,N-1);
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator