当前位置:网站首页>AcWing 1812. 方形牧场(枚举)
AcWing 1812. 方形牧场(枚举)
2022-04-21 15:22:00 【岁忧】
题目:1812. 方形牧场


题解:将这两个矩形分别映射到x轴和y轴上,找出最大区间,然后让这两个区间的长度相乘即可。
#include<bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long LL;
typedef pair<int ,int> PII;
const int N=1e5+10;
const int mod=100000007;
int main(){
int a[2][4];
int b,c,d,e;
b=20,c=0,d=20,e=0;
for(int i=0;i<2;i++){
cin>>a[i][0]>>a[i][1]>>a[i][2]>>a[i][3];
b=min(a[i][0],b);
b=min(a[i][2],b);
c=max(a[i][0],c);
c=max(a[i][2],c);
d=min(a[i][1],d);
d=min(a[i][3],d);
e=max(a[i][1],e);
e=max(a[i][3],e);
}
int t=max(0,c-b);
t=max(t,max(0,e-d));
cout<<t*t;
return 0;
}
版权声明
本文为[岁忧]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_46028214/article/details/124319269
边栏推荐
- What mailbox do foreign trade companies usually use and how to send e-mail in groups?
- 干货 | 移动端App自动化之App控件定位
- 72页互联网智慧园区解决方案
- Jetpack Compose使用自定义操作符实现绘制五角星效果
- SAP UI5 應用開發教程之七十 - 如何使用按鈕控件觸發頁面路由跳轉試讀版
- 【二分查找-简单】441. 排列硬币
- elemetn表单控件---未通过校验字段提交时自动定位到该字段位置
- 干货 | 测试人职场晋升“潜规则”:15 年经验资深测试经理的职场忠告
- Introduction to openlayers (II)
- Elemetn form control --- automatically locate the position of the field when it is submitted without passing the verification field
猜你喜欢

机器学习方法创建可学习的化学语法,构建可合成的单体和聚合物

OpenHarmony相机用户态驱动框架

读书破万“卷”:国民阅读洞察2022

Design and implementation of public welfare website based on JSP

Login refactoring notes

JUC学习记录

Huawei power PON distribution network solution

嵌入式开发:重新利用开发板进行测试的3个技巧

Spark / Scala - read rcfile & orcfile

Openharmony camera user driven framework
随机推荐
APP评测的网站有哪些?
Installation and uninstallation of MySQL
SAP ui5 application development tutorial 70 - how to use button controls to trigger page routing jump trial version
【C语言进阶】自定义类型:结构体,位段,枚举,联合
MySQL
JUC concurrent learning notes
[机器学习导论]——第六课——贝叶斯分类器
Openharmony camera user driven framework
产业园区数字孪生规划方案
【二分查找-简单】367. 有效的完全平方数
[binary search - simple] 278 First wrong version
[binary search - simple] 441 Arrange coins
IT服务管理框架要怎么落地?看这篇就够了
[binary search - simple] 367 Effective complete square
Can station B be called YouTube in China?
111 page data word transformation solution of Fine Chemical Co., Ltd
[binary search - medium] 1498 Number of subsequences satisfying the condition
跟着中富金石学炒股,25年行业沉淀,投资要用实力说话
102页新一代数字化转型信息化总体规划方案
客户端邮件同步到webmail如何操作,电子邮件地址怎么注册?