浙大计算机复试真题2007巡航题杭电acm 1861解决方案!!
# include & ltstdio.h & gt
# include & ltstring.h & gt
typedef结构
{
int号;
int h,m;
int标签;
}节点;
节点a[110];
int main()
{
int no,h,m,times,avetime,ave
char op
memset(a,0,sizeof(a));
次数= 0;
ave time = 0;
while(scanf("%d ",& amp没有)!=EOF)
{
getchar();//吃回车,否则会被后面的字符读出来,是错误的。
if(no==-1)破;
scanf("%c %d:%d ",& amp运算放大器。h & amp;m);
如果(否==0)
{
if(times = = 0)printf(" 0 0 \ n ");
其他
{
ave = ave time/times;
if((double)avetime/times-ave)>= 0.5)ave++;
printf("%d %d\n ",times,ave);
}
memset(a,0,sizeof(a));
次数= 0;
ave time = 0;
}
其他
{
if(op = = ' S ' & amp;& amp答[否]。tag==0)
{
答[否]。h = h
答[否]。m = m
答[否]。tag = 1;
}
else if(op = = ' E ' & amp;& amp答[否]。tag==1)
{
int time=(h-a[no]。h)* 60+(m-a[无]。m);
avetime+= time;
times++;
答[否]。tag = 0;
}
}
}
返回0;
}