zoukankan      html  css  js  c++  java
  • 牛客多校(2020第四场)F Finding the Order

    题目链接:https://ac.nowcoder.com/acm/contest/5669/F

    题意:

    • 有俩条平行线AB,CD
    • 给出AC,AD,BC,BD,问AB//CD还是AB//DC

    题解:

    • 找到这四个距离的最大值
    • 如果最大值来自AD,BC则是AB//CD,否则为AB//DC
     1 #include<iostream>
     2 #include<cstring>
     3 #include<algorithm>
     4 #include<string>
     5 using namespace std;
     6 
     7 int a, b, c, d;
     8 
     9 void solve() {
    10     int max_len = max(max(a,b), max(c,d));
    11     if (max_len == b || max_len == c) {
    12         printf("AB//CD
    ");
    13     }
    14     else {
    15         printf("AB//DC
    ");
    16     }
    17 }
    18 
    19 int main() {
    20     int t;
    21     cin >> t;
    22     while (t--) {
    23         cin >> a >> b >> c >> d;
    24         solve();
    25     }
    26     return 0;
    27 }
  • 相关阅读:
    [SDOI2016]排列计数
    Broken robot
    环路运输
    naptime
    Accumulation Degree
    选课
    没有上司的舞会
    金字塔
    Polygon
    石子合并
  • 原文地址:https://www.cnblogs.com/mr-wei977955490/p/15367566.html
Copyright © 2011-2022 走看看