| ||||||||||
| 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()
{
int a,b,c,num;
string s;int qa[2],qb[2],qc[2];
while(cin>>a>>b>>c)
{
if(a==0&&b==0&&c==0)break;
int result=0;
cin>>s;qa[0]=0;qb[0]=0;qc[0]=0;
while(s!="#")
{
cin>>num;
string s1=string(s.begin(),s.begin()+2);
string s2=string(s.begin()+3,s.end());
int time=((s[0]-48)*10+s[1]-48)*60+(s[3]-48)*10+s[4]-48;
if((num<=2)&&(num>0))
{
if(qa[0]==0){qa[0]=time+30;result+=num;}
else
if(time+30>=qa[0])
{qa[0]=qa[0]+30;result+=num;}
}
if((num>2)&&(num<=4))
{
if(qb[0]==0){qb[0]=time+30;result+=num;}
else
if(time+30>=qb[0])
{qb[0]=qb[0]+30;result+=num;}
}
if((num>4)&&(num<=6))
{
if(qc[0]==0){qc[0]=time+30;result+=num;}
else
if(time+30>=qc[0])
{qc[0]=qc[0]+30;result+=num;}
}
cin>>s;
}
cout<<result<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator