zoukankan      html  css  js  c++  java
  • AIM Tech Round 5 (rated, Div. 1 + Div. 2)

    A. Find Square

    找到对角线的两个点的坐标,这道题就迎刃而解了。

    inline void work(int n) {
        int m;
        cin >> m;
        memset(str, 0, sizeof(str));
        rep(i,1,n) {
            scanf("%s", str+1);
            rep(j,1,m) a[i][j] = (str[j] == 'B' ?  1 : 0);
        }
    
        int lx = 0, ly = 0, rx = 0, ry = 0;
    
        for (int i = n; i >= 1; -- i) {
            rep(j,1,m)
                if (a[i][j] == 1) {lx = i; ly = j;break;}
            if (lx != 0) break;
        }
    
        rep(i,1,n) {
            for (int j = m; j >= 1; -- j)
                if (a[i][j] == 1) {rx = i; ry = j;break;}
            if (rx != 0) break;
        }
    
        cout << (lx + rx) / 2 << " " << (ly + ry) / 2 << endl;
    }
    

    B. Unnatural Conditions

    考虑到位数远远大于(n,m)的值,直接选择构造出(s(a) > max(n), s(b) > max(m), s(a + b) = 1)

    inline void work(int n, int m) {
        rep(i,1,2230) cout << 5;
        cout << endl;
        rep(i,1,2229) cout << 4;
        cout << 5 << endl;
    }
    
  • 相关阅读:
    Wiggle Sort II
    Coin Change
    MPLS LDP 知识要点
    MPLS Aggreate & Untag
    Lab MPLS隐藏标签显示
    Lab MPLS过滤标签转发
    MPLS MTU Aggregation
    研究MPLS MTU的问题
    Lab 利用MPLS解决BGP路由黑洞
    MPLS 标签保留
  • 原文地址:https://www.cnblogs.com/Alessandro/p/9553408.html
Copyright © 2011-2022 走看看