BUPT 2017 summer training (for 16) #1B

题意

Alex is repairing his country house. He has a rectangular metal sheet of size a × b. He has to cut two rectangular sheets of sizes \(a_1\) × $b_1 $and \(a_2\) × \(b_2\) from it. All cuts must be parallel to the sides of the initial sheet. Determine if he can do it.

题解

把所有情况都找一遍,也就是要交换长和宽。

代码

#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
    long long a,b,c,d,e,f;
    scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f);
    bool t=false;
    for(int i=0;i<2;++i){
        for(int j=0;j<2;++j){
            for(int k=0;k<2;++k){
                t|=(max(c,e)<=a&&d+f<=b);
                swap(c,d);
            }
            swap(e,f);
        }
        swap(a,b);
    }
    printf("%s",t?"YES":"NO");
    return 0;
}

相关文章:

  • 2021-08-21
  • 2021-11-02
  • 2021-10-23
  • 2022-02-08
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
猜你喜欢
  • 2021-08-30
  • 2021-08-31
  • 2021-12-11
  • 2021-08-09
  • 2022-01-19
  • 2021-07-24
相关资源
相似解决方案