简单模拟。

#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. bg-render+bg-class+filter

    重点: 1.多层render写法参数下面的html代码段,外层bg-render---><script type='text/html'>--->{{for}}--->b ...

  2. UICollectionView之自定义Layout

    #import <UIKit/UIKit.h> @interface WQViewController : UIViewController - (id)initWithFrame:(CG ...

  3. doclint in jdk8

    http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html Turning off doclint in JDK 8 ...

  4. ccw-ide

    有bug,会把working set弄乱,整理后能重启一次正常,再次重启又乱了.

  5. Augular JS里的各种ng

    Augular JS里的各种ng- 正文: 1.ng-disabled="一种状态:该状态下不可用"例如: %button.btn.btn-2(ng-disabled=" ...

  6. 【转】How to build and install PHP 5.6.9 from source on Ubuntu 14.04 VPS

    原文 https://vpsineu.com/blog/how-to-build-and-install-php-5-6-9-from-source-on-ubuntu-14-04-vps/ In t ...

  7. iOS拨打电话(三种方法)

    iOS拨打电话(三种方法)  查了很多地方的关于iOS程序拨打电话,大都不全,今天我总结了三种方法,各有不同,拿来给大家分享,希望给大家有所帮助 1,这种方法,拨打完电话回不到原来的应用,会停留在通讯 ...

  8. 2015年4月29日 dayofweek

    #include <stdio.h>#include <stdlib.h>int DayofYear(int year, int month, int day);#define ...

  9. Python -- OOP高级 -- __slots__、@property

    __slots__属性可以设置 允许被设置的属性 class Student: __slots__ = ("name", "age") >>> ...

  10. 转:LR性能测试结果样例分析 测试结果分析

    LoadRunner性能测试结果分析是个复杂的过程,通常可以从结果摘要.并发数.平均事务响应时间.每秒点击数.业务成功率.系统资源.网页细分图.Web服务器资源.数据库服务器资源等几个方面分析,如图1 ...