#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
using namespace std;
int sh[1005],sm[1005];
struct ans{
int num;
int ms;
}ans[1005];
int cal(int sh,int sm,int eh,int em){
return (eh * 60 + em) - (sh * 60 + sm);
}
int main(void){
memset(sh,-1,sizeof(sh));
memset(sm,-1,sizeof(sm));
int day;
scanf("%d",&day);
int cnt = 0;
int idd,h,m;
char op[2];
int cntt = 0;
int total = 0;
int acnt = 0;
while(cnt < day){
scanf("%d",&idd);
if(idd == 0){
cnt++;
scanf("%s",op);
scanf("%d:%d",&h,&m);
ans[acnt].num = cntt;
if(cntt != 0){
double temp1 = (double)total / (double) cntt;
int temp2 = total / cntt;
ans[acnt++].ms = temp1 >= (temp2 + 0.5)? temp2 +
L1-043. 阅览室
最新推荐文章于 2018-06-10 23:48:11 发布
这是一个C++程序,用于记录并计算阅览室的使用情况。程序读取输入的天数,每天的开始(S)和结束(E)时间,最后输出每天的使用人数及平均使用分钟数。通过cal函数计算两个时间点之间的时长差距,并用memset初始化存储时间的数据结构。
摘要由CSDN通过智能技术生成