c++与g++区别,交c++对了g++不对?

BEconfidence 2015-07-28 11:07:41
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;
}
...全文
111 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

13,826

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧