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

POJ 1083

时间:2015-06-09 15:28:27      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:

#include<iostream>
#include<stdio.h>
#include<algorithm>
#define MAXN 400
using namespace std;

int a[MAXN];
void op(int & a);
int main()
{
    //freopen("acm.acm","r",stdin);
    int time;
    int num;
    int i;
    int j;
    int begin;
    int end;
    memset(a,0,sizeof(a));
    cin>>time;
    while(time --)
    {
        memset(a,0,sizeof(a));
        cin>>num;
        for(i = 0; i < num; ++ i)
        {
            cin>>begin;
            cin>>end;
            if(begin > end)
                iter_swap(&begin,&end);
            begin = (begin-1)/2;
            end = (end-1)/2;
            for_each(a+begin,a+end+1,op);
        }
        cout<< 10*(*max_element(a,a+MAXN))<<endl;
    }
}
void op(int & a)
{
    a += 1;
}

 

POJ 1083

标签:

原文地址:http://www.cnblogs.com/gavinsp/p/4563261.html

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