zoukankan      html  css  js  c++  java
  • hdu 1050水题

    就是找一个区间,其被覆盖次数最多,输出即可。。

    /*
     * hdu1050/win.cpp
     * Created on: 2012-7-27
     * Author    : ben
     */
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <cmath>
    #include <ctime>
    #include <iostream>
    #include <algorithm>
    #include <queue>
    #include <set>
    #include <map>
    #include <stack>
    #include <string>
    #include <vector>
    #include <deque>
    #include <list>
    #include <functional>
    #include <numeric>
    #include <cctype>
    using namespace std;
    const int MAXN = 205;
    int used[MAXN];
    
    int main() {
    #ifndef ONLINE_JUDGE
        freopen("data.in", "r", stdin);
    #endif
        int T, a, b, M;
        scanf("%d", &T);
        while(T--) {
            memset(used, 0, sizeof(used));
            scanf("%d", &M);
            for(int i = 0; i < M; i++) {
                scanf("%d%d", &a, &b);
                a = (a + 1) / 2;
                b = (b + 1) / 2;
                if(a > b) {
                    a = a ^ b;
                    b = a ^ b;
                    a = a ^ b;
                }
                for(int k = a; k <= b; k++) {
                    used[k]++;
                }
            }
            int ans = 0;
            for(int i = 0; i < MAXN; i++) {
                if(used[i] > ans) {
                    ans = used[i];
                }
            }
            printf("%d\n", ans * 10);
        }
        return 0;
    }
  • 相关阅读:
    python 随机字符串
    Ajax
    Django (Form)
    Django (项目)
    Django (二)
    Django (一)
    Django 学生管理系统
    地理坐标系 与 投影坐标系
    shapefile
    图表绘制工具--Matplotlib 3
  • 原文地址:https://www.cnblogs.com/moonbay/p/2611415.html
Copyright © 2011-2022 走看看