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:hello1 at 2005-07-21 20:54:06 > 我这个程序怎么就是不对呀? > 请帮忙改一下 > #include<stdio.h> > > int pan[10]; > int m,n; > int l; > > void sub(){ > int i,j; > for(i=0;i<n-1;i++){ > pan[n-1]=m-pan[i]; > if(pan[n-2]>pan[n-1]) break; > } > //printf("%d\n",pan[n-1]); > } > void add(int v){ > pan[v]+=1; > } > void backtrace(int k){ > int i,a; > l=0; > if(k==n) l++; //return; > //printf("%d\n",pan[n-1]); > else{ > pan[k]=pan[k-1]; > for(i=1;i<=n;i++){ > sub(); > backtrace(k+1); > if(k==0) return; > > add(k); > > } > } > } > > int main(){ > int i,t,k; > scanf("%d",&t); > while(t>=1&&t<=20){ > scanf("%d %d",&m,&n); > for(i=0;i<n;i++) > pan[i]=0; > backtrace(0); > /*k=n-2; > add(k); > k--;*/ > printf("%d\n",l); > } > return 1; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator