简单模拟。

#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. 关于WIFI DIRECT功能的

    http://processors.wiki.ti.com/index.php/WiFi_Direct_Configuration_Scripts#p2p_find      https://wire ...

  2. android全屏和取消全屏 旋转屏幕

    全屏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); 取消全屏 getWindow().clearFlags(Win ...

  3. iOS开发:后台运行以及保持程序在后台长时间运行

    第一部分 1.先说说iOS 应用程序5个状态: 停止运行-应用程序已经终止,或者还未启动. 不活动-应用程序处于前台但不再接收事件(例如,用户在app处于活动时锁住了设备). 活动-app处于“使用中 ...

  4. 在PL/SQL/sqlplus客户端 中如何让程序暂停几秒钟

    1. how to check procedure exist: SQL> conn oper/oper123Connected.SQL> desc dbms_lock;PROCEDURE ...

  5. 无线手柄+步进电机——控制方向

    今天测试了一下无线手柄控制电机转向的改变 1: #include <PS2X_lib.h> //for v1.6 2: #include <Stepper.h> 3:  4: ...

  6. c3p0连接池的使用

    利用c3p0连接池获取数据库连接,即不再通过DriverManager的getConnection(url,user,password)方法获取connection,而是通过c3p0数据源的类来获取连 ...

  7. 安装mysql ,从 mysql-5.5.5 开始innodb作为默认的存储引擎了

    [root@Linux opt]# tar -xvf MySQL-5.6.16-1.rhel5.x86_64.rpm-bundle.tar MySQL-shared-compat-5.6.16-1.r ...

  8. Android中在activity中弹出一个popwindow

    //-----在onCreate方法--中------创建popwindow布局   --pop_item--------------------------        View view=Lay ...

  9. GetClientRect

    这个函数好像就是对应于视口的,获取视口的宽高 #include <windows.h> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPAR ...

  10. Linux 下 git的使用

    参考链接:http://www.liaoxuefeng.com 安装 安装步骤: ①先给操作系统装入git工具,以Linux为例: $ sudo apt-get install git ②去githu ...