hdu acm 2.2.1 没认真看题,未认真思考

题目链接:点击打开链接

//@auther Yang Zongjun
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>

using namespace std;
#define PI acos(-1.0)
#define EPS 1e-8
const int MAXN = 410;
const int INF = 2100000000;
int vis[MAXN];

struct Table
{
    int from, to;
    
}t[205];

bool cmp(const int& a, const int& b)
{
    return a > b;
}

int main()
{
//    freopen("C:/Users/Administrator/Desktop/input.txt", "r", stdin);
    
    //false则没有没占用
    
    int cas;
    while(~scanf("%d", &cas))
    {
        while(cas--)
    {
        memset(vis, 0, sizeof(vis));
        int n;
        scanf("%d", &n);
        int cnt = 0;
        for(int j = 0; j < n; j++)
        {
            scanf("%d%d", &t[j].from, &t[j].to);
            if(t[j].from >= t[j].to)
            {
                int temp = t[j].from;
                t[j].from = t[j].to;
                t[j].to = temp;
            }
            //cin >> t[j].from >> t[j].to;
            int i;
            for(i = t[j].from; i <= t[j].to; i++)
            {
                vis[i]++;
            }
            /*开始时候没有考虑这点,没有专注到走廊两边是奇偶对称分布的
            而不是线性的数组,这一点需要注意*/
            if((i-1) % 2 == 1)
            {
                vis[i]++;
            }
        }
        sort(vis, vis + MAXN, cmp);
        cnt = vis[0];
        printf("%d\n", 10 * (cnt));
    }
    }
    
    return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值