📄 游船出租.txt
字号:
//test
#include <cstdio>
#include <string>
#include <cmath>
#include <stack>
#include <algorithm>
using namespace std;
bool boat[110];
int start[110];
int key,but,h,m;
int hire,ctime;
int main() {
hire = ctime = 0;
memset(boat,false,sizeof(boat));
while (scanf("%d",&key), key!=-1) {
if (key == 0) {
scanf(" %c %d:%d",&but,&h,&m);
if (hire == 0) puts("0 0");
else printf("%d %.0lf\n",hire,1.0*ctime/hire);
hire = ctime = 0;
memset(boat,false,sizeof(boat));
}
else {
scanf(" %c %d:%d",&but,&h,&m);
if (but == 'S') {
if (!boat[key]) {
start[key] = 60*h +m;
boat[key] = true;
}
}
else {
if (boat[key]) {
boat[key] = false;
hire ++;
ctime += 60*h+m - start[key];
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -