hdu 4883 bestcoder round 2 1001 TIANKENG’s restaurant
来源:互联网 发布:北京云狐网络 编辑:程序博客网 时间:2024/05/19 02:20
题目链接:点击打开链接
由于只有24*60个时间点,所以根据每个group来到和离开的时间增加这些时间点的同时最大人数,最后遍历这1440个点即可
由于一个团队离开的时刻另一个团队可以马上坐他们的位置,所以一个团队在饭店中的时间实际上是离开时间的前一个时间点
所以for(int j=time(G[i].sh,G[i].sm);j<time(G[i].eh,G[i].em);j++) 后面要写小于号
代码:
#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>using namespace std;struct group{ int sh,sm; int eh,em,n;}G[10010];int tt[2000];int time(int a,int b){ return a*60+b;}bool cmp(group a,group b){ return (a.sh*60+a.sm)<(b.sh*60+b.sm);}int main(){ int T; cin>>T; while(T--){ memset(tt,0,sizeof(tt)); int num; int nowt=0; int tot=0; cin>>num; for(int i=1;i<=num;i++){ char time[100]; int n; cin>>G[i].n>>time; char tmp; sscanf(time,"%d%c%d",&G[i].sh,&tmp,&G[i].sm); cin>>time; sscanf(time,"%d%c%d",&G[i].eh,&tmp,&G[i].em); } for(int i=1;i<=num;i++){ for(int j=time(G[i].sh,G[i].sm);j<time(G[i].eh,G[i].em);j++){ tt[j]+=G[i].n; } if( } for(int i=0;i<=1500;i++){ tot=max(tot,tt[i]); } cout<<tot<<endl; } return 0;}
0 0
- hdu 4883 bestcoder round 2 1001 TIANKENG’s restaurant
- BestCoder Round #2 1001 TIANKENG’s restaurant
- BestCoder Round #2 1001TIANKENG’s restaurant
- BestCoder Round #2-TIANKENG’s restaurant
- BestCoder Round #2 1001 TIANKENG’s restaurant(区间内查找)
- HDU 4883 TIANKENG’s restaurant(排序或优先队列模拟)——BestCoder Round #2
- HDU 4883 TIANKENG’s restaurant Bestcoder 2-1(模拟)
- HDU 4883 Best Coder Round 2 TIANKENG’s restaurant 题解
- hdu4883 & BestCoder Round #2 TIANKENG’s restaurant(暴力)
- 模拟考试1 BestCoder Round #2 TIANKENG’s restaurant
- 20140916 【 贪心 】 bestcoder #2 + hdoj 4883 TIANKENG’s restaurant
- BestCoder #2 1001 TIANKENG’s restaurant && Nyoj 168 房间安排
- HDU 4883 TIANKENG’s restaurant
- hdu 4883 TIANKENG’s restaurant
- HDU 4883 TIANKENG’s restaurant
- hdu 4883 TIANKENG’s restaurant
- hdu 4883 TIANKENG’s restaurant
- HDU-4883-TIANKENG’s restaurant
- 用TimelineLite连接多个TweenLite…
- C++ STL--stack/queue 的使用方法
- 【转】JS判断SWF,JPG加载完毕、兼…
- 程序PM的一些感慨和总结
- android-ndk-r9漏洞
- hdu 4883 bestcoder round 2 1001 TIANKENG’s restaurant
- nfs挂载文件系统出现Warning: unable to open an initial console.
- [unity]Unity3d获取APK签名及公钥的方法
- ARM汇编指令中常用的伪指令(一)
- Spring IoC(控制反转)【二】
- 一个不错的GIT入门教程
- hidden symbol __dso_handle reference: link error
- oracle表的删除
- CentOS下端口查看