zju2007游船出租
来源:互联网 发布:淘宝开店需要交税吗 编辑:程序博客网 时间:2024/04/27 15:05
http://acm.hdu.edu.cn/showproblem.php?pid=1861
浙大计算机研究生复试上机考试-2007年
#include <stdio.h>#include <string.h>struct Node{int no;int h,m;int tag;}a[105]; //保存第i号船的时间信息int main(){ int h,m,no; char ch; memset(a,0,sizeof(a)); //不能放在while循环内,多组数据输入之间有求和关系 int times=0,avetime=0; //不能每次输入都清空 while (scanf("%d",&no)&& no!=-1) { scanf(" %c %d:%d",&ch,&h,&m); if (no==0) { if (times==0) { printf("0 0\n"); } else { if (avetime*1.0/times - avetime/times >=0.5) { avetime=avetime/times+1; } else { avetime/=times; } printf("%d %d\n",times,avetime); } memset(a,0,sizeof(a)); //一天的数据求和完毕,清空变量 times=0,avetime=0; } else { if (ch=='S'&&a[no].tag==0) { a[no].h=h; a[no].m=m; a[no].tag=1; } else if (ch=='E'&&a[no].tag==1) { int time=(h-a[no].h)*60-a[no].m+m; //计算累加时间 avetime+=time; //所以另外定义中间变量保存每艘船的时间 times++; a[no].tag=0; } } } return 0;}
- zju2007游船出租
- 九度oj 题目1022:游船出租 【ZJU2007考研机试题3】
- 游船出租
- 游船出租
- hdu 1861 游船出租
- 1861游船出租
- 题目1022:游船出租
- 题目1022:游船出租
- hdu 1861 游船出租
- hdu 1861-游船出租
- 题目1022:游船出租
- OJ_1022 游船出租
- 题目1022:游船出租
- 1022.游船出租
- 题目1022:游船出租
- HDU--1861:游船出租
- HDU 1861 游船出租
- 题目1022:游船出租
- HTK的使用方法
- 关于系统设计的一些想法
- dell T110 安装xen 虚拟化
- Compilation of Views and PL/SQL Program Units【每日一译】--2013-1-10
- 9 ways you can boost your memory
- zju2007游船出租
- 黑马程序员- Java实现的几个常用排序算法详细解读
- POJ-2488-A Knight's Journey
- Android通过HTTP协议实现上传文件数据
- 黑马程序员--GUI和网络编程
- JS正则表达式验证数字
- 设计模式(一)——策略模式
- BaseDao
- 安装 SQL Server Compact Edition