zoukankan      html  css  js  c++  java
  • SRM 546 div2

      早晨7点到实验室一翻邮箱看到tc的邮件。。。srm 546,因为昨晚去复习,没来实验室,所以不知到又比赛。T_T 早晨抽出一小时翻了翻。。。

    250pt

    水题

    550pt

    不好想,反正我的思路很复杂,写难产了。然后看到别人的写,无语的是就几行代码搞定。不得不佩服啊

    class TwoRectangles {
    public:
        string describeIntersection(vector <int> A, vector <int> B) {
            int c[4];
            c[0] = max(A[0], B[0]);
            c[1] = max(A[1], B[1]);
            c[2] = min(A[2], B[2]);
            c[3] = min(A[3], B[3]);
            
            if(c[0] == c[2] && c[1] == c[3])    return "point";
            if(c[0] < c[2] && c[1] < c[3])    return "rectangle";
            if(c[0] > c[2] || c[1] > c[3])    return "none";
            return "segment";
        }
    };
  • 相关阅读:
    Flink核心技术
    Flink学习问题和答案
    Spark知识点总结
    Scala知识点总结
    Spark测试题
    Hadoop概念试题
    IntelliJ IDEA 2019 快捷键终极大全
    Linux入门
    javaSe知识点总结
    Data
  • 原文地址:https://www.cnblogs.com/vongang/p/2552657.html
Copyright © 2011-2022 走看看