码迷,mamicode.com
首页 > 其他好文 > 详细

贪心/Hdu 1050 Moving Tables

时间:2014-12-11 23:39:22      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   color   sp   for   div   log   bs   

#include<cstdio>
#include<cstring>
using namespace std;
int a[220];
int cmax(int a,int b){return a>b?a:b;}
int main()
{
    int T;
    scanf("%d",&T);
    for (int t=1;t<=T;t++)
    {
        int n;
        scanf("%d",&n);
        int x,y,xx,yy;
        int ans=0;
        memset(a,0,sizeof(a));
        for (int i=1;i<=n;i++)
        {
            scanf("%d%d",&x,&y);
            xx=(x+1)/2;yy=(y+1)/2;
            if (xx>yy)
            {
                int tt=xx;
                xx=yy;
                yy=tt;
            }
            for (int j=xx;j<=yy;j++)
            {
                a[j]++;
                ans=cmax(ans,a[j]);
            }
        }
        printf("%d\n",ans*10);
    }
    return 0;
}

 

贪心/Hdu 1050 Moving Tables

标签:style   blog   io   color   sp   for   div   log   bs   

原文地址:http://www.cnblogs.com/NicoleLam/p/4158623.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!