• hdu 1050 (preinitilization or postcleansing, std::fill) 分类: hdoj 2015-06-18 11:33 34人阅读 评论(0) 收藏


    errors, clauses in place, logical ones, should be avoided.

    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    
    int main() {
        //freopen("input.txt","r",stdin);
        const int CorNum=201;
        int ncase, npair, to,from, first,last, res;
        int shared[CorNum]={0};
        if(scanf("%d",&ncase)!=1) return -1;
        while(ncase-- && scanf("%d",&npair)==1) {
            first=CorNum, last=0;
            while(npair--) {
                scanf("%d%d",&from,&to);
                from=(from-1)>>1; to=(to-1)>>1;
                if(from>to) std::swap(from,to);
                first=std::min(first,from); last=std::max(last,to);
                for(;from<=to;++from) ++shared[from];
            }
            for(res=0,from=first;from<=last;++from) res=std::max(res,shared[from]);
            std::fill(&shared[first],&shared[last+1],0);
            printf("%d
    ",res*10);
        }
        return 0;
    }

    版权声明:本文为博主原创文章,未经博主允许不得转载。// p.s. If in any way improment can be achieved, better performance or whatever, it will be well-appreciated to let me know, thanks in advance.

  • 相关阅读:
    Metasploit的使用命令_1
    Kali Linux -系统定制
    20200522随笔
    阿里大于接口的问题
    根据一篇文章学习逻辑漏洞
    flask注册蓝图报错
    python 生成验证码
    flask-mail 机制
    对巡风vulscan的理解
    “百度杯” YeSerCMS
  • 原文地址:https://www.cnblogs.com/qeatzy/p/4716225.html
Copyright © 2020-2023  润新知