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:帮帮忙,大哥大姐们.就是交不了!!!郁闷了! Posted by:00448166 at 2005-03-06 22:16:15 新手:不是大哥大姐们. #include <iostream.h> int num(int m,int n,int min) { int i; if(m==0) return 1; if(n==1) return 1; int j=0; for(i=min;i<=m;i++) { if((m-i)>=i||(m-i)==0) j=j+num(m-i,n-1,i); } return j; } int main() { int a[20]; int b[20]; int times; cout<<"input times:"<<endl;//这里不要看看吧 cin>>times; int i; cout<<"input m , n:"<<endl;//一样, for(i=0;i<times;i++) { cin>>a[i]>>b[i]; } for(i=0;i<times;i++) { cout<<num(a[i],b[i],1)<<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