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

help!

Posted by pkueducn1 at 2004-12-25 21:19:59 on Problem 1017
#include<stdio.h>
#include<math.h>
void main(){
	int a[6],i,count,j,n=0;
	for(i=0;i<6;i++)
			scanf("%d",&a[i]);
    for(j=0;j<6;j++)
		if(a[j]==0) n+=1;
	while(n<6){
		count=a[5]+a[4]+a[3]+ceil(a[2]/4.0);
		a[2]=4-a[2]%4;
		if(a[2]==4) a[2]=0;
		if(a[2]==3) {
			a[1]-=5;
			a[0]-=7;
			if(a[1]<0){
				a[1]=0;
				a[0]-=(5-a[1])*4;
				if(a[0]<0) a[0]=0;}
		}
		if(a[2]==2) {
			a[1]-=3;
			a[0]-=5;
			if(a[1]<0){
				a[1]=0;
				a[0]-=(3-a[1])*4;}
		}
		if(a[2]==1) {
			a[1]-=1;
			a[0]-=5;
			if(a[1]<0){
				a[1]=0;
				a[0]-=4;
				if(a[0]<0) a[0]=0;}
		}
		if(a[0]>=a[4]*11) a[0]-=a[4]*11;
		if(a[0]<0) a[0]=0;
		if(ceil(a[0]/4.0)+a[1]>a[3]*5)
			count+=ceil(ceil(a[0]/4.0)+a[1]-5*a[3])/9.0;
		printf("%d\n",count);
		for(i=0;i<6;i++)
			scanf("%d",&a[i]);
		n=0;
		for(j=0;j<6;j++)
		    if(a[j]==0) n+=1;
	}
}


在VC里运行的好好的,但就是通不过.实在不知道有什么情况没有考虑到.请各们高手多多指教!

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