Hot Expo
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 886 Accepted Submission(s): 423
Input is terminated by a value of zero (0) for n.
2 1 4 4 5 2 2 3 4 6 0
2 1
代码如下:
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<ctime>
using namespace std;
int a[102], b[102];
int ans[86402];
int main()
{
#ifdef test
freopen("in.txt", "r", stdin);
#endif
int n;
while(scanf("%d", &n), n)
{
int start = 86402, end = -1;
memset(ans, 0, sizeof(ans));
for(int i = 0; i < n; i++)
{
scanf("%d%d", &a[i], &b[i]);
for(int j = a[i]; j <= b[i]; j++)
ans[j]++;
if(a[i] < start)
start = a[i];
if(b[i] > end)
end = b[i];
}
int max = 0;
for(int i = start; i < end; i++)
if(max < ans[i])
max = ans[i];
printf("%d\n", max);
}
return 0;
}
1万+



被折叠的 条评论
为什么被折叠?



