hdoj 4883

Hotel because it is too hot and the delicious!

The number of different customers at different times
but each time all customers should have a chair to sit on
and do not waste more chairs
so
the number of chairs long just to meet the

  • Up to the customer number

The number of chairs needed to
so when people look for the most of it!

  • How to find it
    because time is an integer
    therefore intermittent discontinuity
    can be represented by an array of every minute of the number
    and then find the maximum number Jiuhaola

code show as below

#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
struct customer{
	int a;
	int b;
	int c;
}a[10010];
int main()
{
	int t,n,hh1,mm1,hh2,mm2,sum[10010];
	cin>>t;
	while(t--)
	{
		cin>>n;
		memset(sum,0,sizeof(sum));
		for(int i=0;i<n;i++)
		{
			scanf("%d",&a[i].a);
			scanf("%d:",&hh1);
			scanf("%d",&mm1);
			scanf("%d:",&hh2);
			scanf("%d",&mm2);
			a[i].b=hh1*60+mm1;          //时间用分钟表示
			a[i].c=hh2*60+mm2;
		    for(int j=a[i].b;j<a[i].c;j++ )
			{
				sum[j]=sum[j]+a[i].a ;   ///每一分钟的人数
			 } 
    	}
    	sort(sum,sum+2001);
		cout<<sum[2000]<<endl;
	}
	return 0;
}
Published 34 original articles · won praise 0 · Views 600

Guess you like

Origin blog.csdn.net/Luyoom/article/details/88429485