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?????????????????-------------------post program c++

Posted by mathsoft at 2006-03-03 20:08:28 on Problem 1017
#include<stdio.h>
int main()
{int a1,a2,a3,a4,a5,a6,na3,na2,pre_na2,pre_na1;
 while(1){ 
 scanf("%d%d%d%d%d%d",&a1,&a2,&a3,&a4,&a5,&a6);
 if((a1+a2+a3+a4+a5+a6)==0) break;
 na3=a3/4;
 pre_na2=5*a4;
 pre_na1=11*a5;
 switch(a3%4)
 {case 1:pre_na2+=5;pre_na1+=7;break;
  case 2:pre_na2+=3;pre_na1+=6;break;
  case 3:pre_na2+=1;pre_na1+=5;break;
 }
 if(pre_na2>=a2) 
 {pre_na1+=4*pre_na2;
  if(pre_na1>=a1) printf("%d\n",a4+a5+a6+na3+1);
  else printf("%d\n",a4+a5+a6+na3+(a1-pre_na1)/36+1);
 }
 else 
 {na2=((a2-pre_na2)/9+1);pre_na1+=4*(9-a2+pre_na2)%9;
  if(pre_na1>=a1) printf("%d\n",a4+a5+a6+na3+na2);
  else printf("%d\n",a4+a5+a6+na3+(a1-pre_na1)/36+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