Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
那位好心人帮我看下错哪里了,谢啦!!!#include <iostream> using namespace std; int main() { while(true) { int s[7]; int n=0; for(int i=1;i<=6;i++) { cin>>s[i]; n+=s[i]; } if(n==0) return 1; int sum=s[4]+s[5]+s[6]+s[3]/4; s[1]=s[1]-11*s[5]; s[2]=s[2]-5*s[4]; s[3]=s[3]%4; switch(s[3]) { case 1:s[1]-=7;s[2]-=5;sum+=1;break; case 2:s[1]-=6;s[2]-=3;sum+=1;break; case 3:s[1]-=4;s[2]-=1;sum+=1;break; } if(s[1]<=0 && s[2]>0) { if(4*s[2]%36==0) sum+=4*s[2]/36; else sum+=(4*s[2]/36+1); } else if(s[1]>0 && s[2]>=0) { int m=(s[1]+4*s[2]); if(m%36==0) sum+=m/36; else sum+=(m/36+1); } else if(s[1]>0 && s[2]<0) { int m=s[1]+4*s[2]; if(m>0 && m<=36) sum+=1; if(m>0 && m>36) { if(m%36==0) sum+=m/36; else sum+=(m/36+1); } } cout<<sum<<endl; } return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator