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 |
帮帮忙,大哥大姐们.就是交不了!!!郁闷了!#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