| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:没有啊,你只要统计出占用的次数最多的一段就可以了In Reply To:Re:没有啊,你只要统计出占用的次数最多的一段就可以了 Posted by:zhujie at 2006-03-15 09:05:32 和你的方法一样,搞不清楚为什么WA
> 请问这样做对吗?我就是统计出占用次数最多的一段,可就是WA啊,查不出哪错了
> #include <stdio.h>
>
> int main()
> {
> int cas,n,i,up,down,temp;
> int a[200];
> scanf("%d",&cas);
> while (cas--)
> {
> scanf("%d",&n);
> for (i=0; i<200; i++) a[i] = 0;
> while (n--)
> {
> scanf("%d %d",&down,&up);
> if (down > up)
> {
> temp = down;
> down = up;
> up = down;
> }
> down = (down - 1) / 2;
> up = (up - 1) / 2;
>
> for (i=down; i<=up; i++)
> a[i]++;
> }
> int max = 0;
> for (i=0; i<200; i++)
> if (a[i] > max) max = a[i];
> printf("%d\n",max * 10);
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator