Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:求助

Posted by lily at 2005-09-02 22:04:39 on Problem 1664
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator