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

求助WA 的数据!源程序如下

Posted by chenboy at 2006-01-05 12:47:51 on Problem 1664
#include<math.h>
#include<stdio.h>
int disk[12],i,j,M,N,m,n,l,num=1,platenum=2;
void main(){
	void plate();
	scanf("%d",&n);
	for(l=0;l<n;l++){
	num=1;
	scanf("%d",&M);
	scanf("%d",&N);
	disk[0]=M;
	for(m=1;m<N;m++){
		disk[m]=0;
	}
	j=0;
	for(i=2;i<=N;i++){
        disk[0]=M;
	    for(m=1;m<N;m++){
		    disk[m]=0;
		}
	    plate();
	}
	printf("%d\n",num);
	}
}
void plate(){
	if((disk[j]-disk[j+1]<=1)&&(j==0)) return;
	else if(j==i-1){
		j--;
		plate();
	}
	else if(disk[j]-disk[j+1]<=1){
		j--;
		plate();
	}
	else{
		disk[j]--;
		disk[j+1]++;
		j++;
		if(disk[i-1]!=0) num++;
		plate();
	}
}

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