简单模拟。

#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<map>
#include<queue>
using namespace std; struct X
{
long long hh,mm,ss;
long long len;
long long st,ml;
}s[+];
int n,k;
long long win[]; bool cmp(const X&a,const X&b)
{
return a.st<b.st;
} int main()
{
scanf("%d%d",&n,&k);
for(int i=;i<=n;i++)
{
scanf("%lld:%lld:%lld %lld",&s[i].hh,&s[i].mm,&s[i].ss,&s[i].len);
s[i].st=s[i].hh**+s[i].mm*+s[i].ss;
s[i].len=s[i].len*;
}
sort(s+,s++n,cmp);
for(int i=;i<=k;i++) win[i]=**;
int i;
int cnt=;
for(int i=;i<=n;i++)
{
long long Min=;
if(s[i].st>**) break;
cnt++;
for(int j=;j<=k;j++) Min=min(Min,win[j]);
for(int j=;j<=k;j++)
{
if(win[j]==Min)
{
s[i].ml=max(win[j],s[i].st);
win[j]=s[i].ml+s[i].len;
break;
}
}
}
long long sum=;
for(int k=;k<=cnt;k++) sum=sum+s[k].ml-s[k].st;
if(cnt!=) printf("%.1f\n",1.0*sum//cnt);
else printf("0.0\n");
return ;
}

PAT (Advanced Level) 1017. Queueing at Bank (25)的更多相关文章

  1. 【PAT甲级】1017 Queueing at Bank (25 分)

    题意: 输入两个正整数N,K(N<=10000,k<=100)分别表示用户的数量以及银行柜台的数量,接下来N行输入一个字符串(格式为HH:MM:SS)和一个正整数,分别表示一位用户到达银行 ...

  2. PAT 甲级 1017 Queueing at Bank (25 分)(模拟题,有点思维小技巧,第二次做才理清思路)

    1017 Queueing at Bank (25 分)   Suppose a bank has K windows open for service. There is a yellow line ...

  3. PAT 1017 Queueing at Bank (25) (坑题)

    Suppose a bank has K windows open for service. There is a yellow line in front of the windows which ...

  4. PAT甲题题解-1017. Queueing at Bank (25)-模拟

    有n个客户和k个窗口,给出n个客户的到达时间和需要的时长有空闲的窗口就去办理,没有的话就需要等待,求客户的平均时长.如果在8点前来的,就需要等到8点.如果17点以后来的,则不会被服务,无需考虑. 按客 ...

  5. 1017. Queueing at Bank (25)

    Suppose a bank has K windows open for service. There is a yellow line in front of the windows which ...

  6. 1017. Queueing at Bank (25) - priority_queuet

    题目如下: Suppose a bank has K windows open for service. There is a yellow line in front of the windows ...

  7. 1017 Queueing at Bank (25)(25 point(s))

    problem Suppose a bank has K windows open for service. There is a yellow line in front of the window ...

  8. 1017 Queueing at Bank (25 分)

    Suppose a bank has K windows open for service. There is a yellow line in front of the windows which ...

  9. PAT (Advanced Level) 1113. Integer Set Partition (25)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

随机推荐

  1. Go-new和make

    new返回指向struct的指针,new仅分配内存,而不对对象的值进行初始化 make返回到strcut的对象,而不是指针,只能创建map,slice,channel对象 make([]string, ...

  2. cisco 2950 3550 3750 系列交换机密码破解

    破解密码原则:只删除密码 ,不破坏配置#本文中的#号表示注释的意思#第一步. 连接交换机的console口到终端#第二步. 按住交换机面板上的mode键的同时 插入电源,直到sys灯不闪,常亮再松开m ...

  3. 微信支付WxpayAPI_php_v3(二)支付功能开发

    这里我没有开发openid和acessToken的获取,需要的请参考文档获取. 在阅读本教程之前请熟读微信支付的开发者文档. 直接开始[统一下单],在实际开发的项目中一般都有mvc分层的开发思想. 根 ...

  4. Boost的VS开发环境搭建

    1. 下载并解压Boost C++ Libs 下载地址: SourceForge:http://sourceforge.net/projects/boost/files/boost/1.48.0/ B ...

  5. nginx libpcre.so.1: cannot open shared object file

    linux 64位安装nginx后启动出错报以下错误 1 2 3 [root@localhost nginx-1.3.0]# /usr/local/nginx/sbin/nginx error whi ...

  6. Response.Flush()

    Response.Buffer=True就是在缓存网页 访问网站一般是程序直接输出网页结果,或从缓存中读取网页结果2种方式.两种方式在速度上是有差异的 设置 Response.Buffer = Tru ...

  7. LA 4329 BIT 分治

    #include <cstdio> #include <queue> #include <cstring> #include <iostream> #i ...

  8. 【转】ethtool 命令详解

    命令描述: ethtool 是用于查询及设置网卡参数的命令. 使用概要:ethtool ethx       //查询ethx网口基本设置,其中 x 是对应网卡的编号,如eth0.eth1等等etht ...

  9. java代码用dom4j解析xml文件的简单操作

    时间: 2016/02/17 目标:为telenor的ALU Femto接口写一个采集xml文件并解析出locationName标签里的值,然后更新到数据库中. 从网上搜了下,有四种常用的解析xml的 ...

  10. Loadrunner之脚本的调试和保存(六)

    一.调试脚本 脚本录制完毕后,按F5键或单击菜单上的RUN按钮,可以运行脚本.       在VIRTUAL USER GENERATOR中运行脚本的作用,主要是查看录制的脚本能否正常通过,如果有问题 ...