hdu4883
来源:互联网 发布:return在c语言中的用法 编辑:程序博客网 时间:2024/05/29 20:01
题目:点击打开链接
题意:
题目就是给你有多少个人,在哪个时刻来,在哪个时刻走,定义个sum数组,记录每个时刻的人数,最后得出结果即可
因为一共只有24个小时不会超时
代码:
#include <iostream>#include <cstdio>#include <cmath>#include <algorithm>#include <cstring>using namespace std;int main(){ int t,n; int x,h1,m1,h2,m2; int sum[1441]; cin>>t; while(t--) { cin>>n; memset(sum,0,sizeof(sum)); for(int i=0;i<n;i++) { scanf("%d %d:%d %d:%d",&x,&h1,&m1,&h2,&m2); int start=h1*60+m1; int endd=h2*60+m2; sum[start]+=x; sum[endd]-=x; } int ans=sum[0]; for(int i=1;i<=1440;i++) { sum[i]+=sum[i-1]; ans=max(ans,sum[i]); } printf("%d\n",ans); } return 0;}
0 0
- hdu4883
- HDU4883
- HDU4883模拟
- hdu4883(贪心)
- hdu4883/BestCoder#2_1001
- TIANKENG’s restaurant--hdu4883
- HDU4883 TIANKENG’s restaurant 【贪心】
- hdu4883 & BestCoder Round #2 TIANKENG’s restaurant(暴力)
- hdu4883 TIANKENG’s restaurant 模拟下就好了
- java基础之static关键字(1)
- 算法竞赛入门-枚举-7.3.3-二进制法
- 解决java compiler level does not match the version of the installed java project facet
- JavaMelody应用监控使用指南
- CUDA学习2015.10.29
- hdu4883
- UItableBarController
- BZOJ 3123 [Sdoi2013]森林 主席树+启发式合并
- 4Sum
- Jedis操作实例
- SDimage
- gdb寻找死锁
- 【NOIP2006普及】数列 快速幂+找规律
- 洛谷1345奶牛的电信(最小点割)