博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 4884 TIANKENG’s rice shop(模拟)
阅读量:7239 次
发布时间:2019-06-29

本文共 857 字,大约阅读时间需要 2 分钟。

# include 
# include
# include
# include
using namespace std;int max(int a,int b){ return a>b?a:b;}int main(){ int T,n,t,k,m,i,hh,min,id,num,x; int last[1010];//最后一次開始炒饭的时间 int cot[1010];//剩下的炒饭 scanf("%d",&T); while(T--) { scanf("%d%d%d%d",&n,&t,&k,&m); memset(cot,0,sizeof(cot)); int cur=0; while(m--) { scanf("%d:%d%d%d",&hh,&min,&id,&num); hh=hh*60+min; if(cot[id]>=num&&last[id]>=hh) { cot[id]-=num; printf("%02d:%02d\n",((last[id]+t)/60)%24,(last[id]+t)%60); continue; } if(cot[id]&&last[id]>=hh) { num-=cot[id]; } if(num%k)//还须要抄几次 x=num/k+1; else x=num/k; cur=max(cur,hh)+t*x; printf("%02d:%02d\n",(cur/60)%24,cur%60); cot[id]=x*k-num; last[id]=cur-t; } if(T) puts(""); } return 0;}

版权声明:本文博客原创文章。博客,未经同意,不得转载。

你可能感兴趣的文章
江山代有才人出 | 微软亚洲研究院建院二十周年
查看>>
Linux安装gitlab
查看>>
java源码-synchronized
查看>>
PostgreSQL 10.1 手册_部分 III. 服务器管理_第 21 章 数据库角色_21.2. 角色属性
查看>>
《刻意练习》读后感
查看>>
DataWorks V2.0 系列公开课
查看>>
使用 logstash, elasticsearch, kibana 搭建日志分析系统
查看>>
Android Q 将获得大量的隐私保护功能
查看>>
《恋恋笔记本》观后感
查看>>
Spring源码剖析6:Spring AOP概述
查看>>
Maven的POM.xml配置大全
查看>>
SmartRefreshLayout + BaseRecyclerviewAdapterHelper 使用MVP方式实现下拉刷新
查看>>
详解KVC(转载)
查看>>
tp5 发送阿里云短信
查看>>
cookie java spring
查看>>
Thrift之TProcess类体系原理及源码详细解析
查看>>
python写的一段分页的代码
查看>>
阿里巴巴数学大赛赛题公布,你敢来挑战吗?(含参考答案)
查看>>
设计模式六大原则(1):单一职责原则
查看>>
ubnutu日常使用软件
查看>>