前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【Gym 100971G】Repair

【Gym 100971G】Repair

作者头像
饶文津
发布2020-06-02 15:31:16
7410
发布2020-06-02 15:31:16
举报
文章被收录于专栏:饶文津的专栏饶文津的专栏

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.

题解

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

代码

代码语言:javascript
复制
#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;
}
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017-07-18 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 题意
  • 题解
  • 代码
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档