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

跪求大牛们看看 过了1000个数据还是wa

Posted by Lyshen at 2010-11-30 12:03:35 on Problem 1017
#include<stdio.h>
int f(int n1,int n2,int n3,int n4,int n5,int n6);
int main()
{
  int l,ok,i,n1,n2,n3,n4,n5,n6;
  l=ok=i=n1=n2=n3=n4=n5=n6=0;


  while (1) 
   {
     scanf("%d %d %d %d %d %d",&n1,&n2,&n3,&n4,&n5,&n6);
	  if (n1 == 0&&n2 == 0&&n3 == 0&& n4 == 0&& n5 == 0&&n6 == 0)
	      break;

	  else { printf("%d\n",f(n1,n2,n3,n4,n5,n6));}
   }

  return 0;
}

int f(int n1,int n2,int n3,int n4,int n5,int n6)
 { int n,m1,m2,a,b;
   n=a=b=0;
   m1=n1;  m2=n2;
     /*6,5*/
	n=n6+n5;
	m1=m1-n5*11;

     /*4*/
	n=n+n4;
	 if (n4<=m2)
	   m2=m2-n4*5;
	 else {
	       a=m2/5;
		b=m2%5;
		 m1=m1-20*(n4-a-1)-4*(5-b);
		m2=0;
	      }

     /*3*/
	a=n3/4;
	b=n3%4;
	 if (b==0)
	    n=n+a;
	 else {
	       n=n+a+1;
		if (b==1)
		   { if (m2>=5)
			{ m2=m2-5;
			  m1=m1-7;
			}
		     else {m1=m1-7-(5-m2)*4;
			   m2=0;
			  }
		   }
		   else ;

		if (b==2)
		   { if (m2>=3)
		       { m2=m2-3;
			 m1=m1-6;
		       }
		     else {m1=m1-(3-m2)*4-6;
			   m2=0;
			  }
		   }
		   else ;

		if (b==3)
		   { if (m2>=1)
			{m2=m2-1;
			 m1=m1-5;
			}
		     else {m1=m1-9;
			   m2=0;
			  }
		   }
		   else;
	       }
     /*2*/
     a=m2/9;
     b=m2%9;
     if (m2>0)
	{if (b==0)
	     n=n+a;
	 else {n=n+a+1;
	       m1=m1-(9-b)*4;
	      }
	}

     /*1*/
     if (m1>0)
	{a=m1/36;
	 b=m1%36;
	 if (b==0)
	    n=n+a;
	 else n=n+a+1;
	}
   return(n);
  }

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