• cf618 训练cde


    面完试第一场vp cf,感觉题目挺规矩的,可能是有些历史了

    c

    #include <bits/stdc++.h>
    using namespace std;
    const int inf = 0x3f3f3f3f;
    const int mod = 1e9 + 7;
    const int N = 1e5 + 10;
    int sum[N];
    int main() {
        int n;
        scanf("%d", &n);
        vector<int> a(n);
        int ma = 0;
        for (auto& i : a) {
            scanf("%d", &i);
            int cnt = 0, t = i;
            while (t) {
                if (t & 1) {
                    ++sum[cnt];
                }
                t >>= 1;
                cnt++;
            }
            ma = max(ma, cnt);
        }
        int ans = inf;
        for (int i = ma - 1; i >= 0; i--) {
            if (sum[i] == 1) {
                ans = i;
                break;
            }
        }
        if (ans != inf) {
            int tp = 0;
            for (int i = 0; i < n; i++) {
                if (a[i] & (1 << ans)) {
                    tp = i;
                    break;
                }
            }
            printf("%d", a[tp]);
            for (int i = 0; i < n; i++) {
                if (i != tp) {
                    printf(" %d", a[i]);
                }
            }
            printf("
    ");
        }
        else {
            for (int i = 0; i < n; i++) {
                printf("%d", a[i]);
                if (i != n - 1) printf(" ");
                else printf("
    ");
            }
        }
        return 0;
    }

    d,有点几何的感觉

    #include <bits/stdc++.h>
    using namespace std;
    const int mod = 1e9 + 7;
    const int N = 1e5 + 10;
    const double  eps = 1e-9;
    struct point {
        int x, y;
        point operator - (const point& b) {
            return { x - b.x, y - b.y };
        }
        bool operator == (const point& b) {
            return x == b.x && y == b.y;
        }
    };
    bool ki(point a, point b, point c, point d) {
        return (b - a) == (c - d);
    }
    int main() {
        int n;
        scanf("%d", &n);
        vector<point> q(n);
        for (auto& v : q) {
            scanf("%d%d", &v.x, &v.y);
        }
        if (n & 1) {
            printf("NO
    ");
        }
        else {
            bool can = true;
            for (int i = 0; can && i < n / 2; i++) {
                if (!ki(q[i], q[i + 1], q[i + n / 2], q[(i + n / 2 + 1) % n])) {
                    can = false;
                }
            }
            if (can)printf("YES
    ");
            else printf("NO
    ");
        }
        return 0;
    }

    e,也是几何。。

    #include <bits/stdc++.h>
    using namespace std;
    const int mod = 1e9 + 7;
    const int N = 1e5 + 10;
    const double  eps = 1e-9;
    struct point {
        int x, y;
        point operator - (const point& b) {
            return { x - b.x, y - b.y };
        }
        bool operator == (const point& b) {
            return x == b.x && y == b.y;
        }
    };
    bool ki(point a, point b, point c, point d) {
        return (b - a) == (c - d);
    }
    int main() {
        int n;
        scanf("%d", &n);
        vector<point> q(n);
        for (auto& v : q) {
            scanf("%d%d", &v.x, &v.y);
        }
        if (n & 1) {
            printf("NO
    ");
        }
        else {
            bool can = true;
            for (int i = 0; can && i < n / 2; i++) {
                if (!ki(q[i], q[i + 1], q[i + n / 2], q[(i + n / 2 + 1) % n])) {
                    can = false;
                }
            }
            if (can)printf("YES
    ");
            else printf("NO
    ");
        }
        return 0;
    }
    View Code
  • 相关阅读:
    app移动测试 (自动化遍历方法和技巧)(转载大佬)
    使用Jmeter录制脚本并调试
    整理token,session ,cookies 和正则表达式整理
    ·接口测试核心:URL&HTTP协议详解
    性能测试基本概念 聚合报告指标分析
    数据分析技能点梳理
    数据分析整体知识点架构(转载)
    数据分析职业前景规划
    数据分析三年建议指导(书籍等)
    系统吞吐量(TPS)、用户并发量、性能测试概念和公式 (转载)
  • 原文地址:https://www.cnblogs.com/zsben991126/p/13193260.html
Copyright © 2020-2023  润新知