2007年第3题
题目地址:http://jobdu.sinaapp.com/problem.php?pid=1022
C语言源码:
#include<stdio.h>typedef struct boat{int time;int state;}boat;boat b[101];int main(){int num,i,stime,snum,minite,hour;char state;scanf("%d",&num);while(num!=-1){for(i=0;i<101;i++)b[i].state=-1;snum=0;stime=0;while(num!=0){scanf(" %c %d:%d",&state,&hour,&minite);if(state=='S'&&b[num].state==-1){b[num].time=hour*60+minite;b[num].state=1;}if(state=='E'&&b[num].state==1){snum++;stime+=hour*60+minite-b[num].time;b[num].state=-1;}scanf("%d",&num);}if(num==0)scanf(" %c %d:%d",&state,&hour,&minite);if(snum==0)printf("0 0\n");elseprintf("%d %.0lf\n",snum,(double)stime/snum);scanf("%d",&num);}}