c++与g++区别,交c++对了g++不对?
hdu1861
#include<cstdio>
#include<cstring>
using namespace std;
struct boat
{
int time;
bool ok;
int sum;
int init;
}ship[100 + 10];
int main()
{
memset(ship,0,sizeof(ship));
int n;
while(scanf("%d",&n)&&n!=-1){
if(!n){
int a,b;
char pp;
scanf(" %s %d:%d",&pp,&a,&b);
double finalsum=0;
double number=0;
for(int i=1;i<=100;i++)
if(ship[i].sum != 0){
finalsum += ship[i].sum;
number+=ship[i].time;
}
if(finalsum==0) printf("0 0\n");
else
printf("%.0lf %.0lf\n",number,finalsum/number);
memset(ship,0,sizeof(ship));
}
else if(n){
char c;
scanf("%s",&c);
if(c == 'S'){
ship[n].ok=1;
int a,b;
scanf("%d:%d",&a,&b);
ship[n].init = a*60+b;
}
else if(c == 'E' && ship[n].ok==1){
ship[n].time++;
int a,b;
scanf("%d:%d",&a,&b);
ship[n].sum += ((a*60+b ) - ship[n].init );
}
else {
int a,b;
scanf("%d:%d",&a,&b);
}
}
}
return 0;
}