Codeforces Round #331 (Div. 2)A. Wilbur and Swimming Pool(简单计算)
来源:互联网 发布:网络有什么赚钱项目 编辑:程序博客网 时间:2024/06/03 15:28
题目链接
题意:给出n个点,问能否计算出以这n(n<=4)个点为顶点的矩形面积。
解法:找对角线的点,计算即可
悲剧:读题不仔细害死人= =。夜里做的时候没有看到数据的输入保证,写了很多判断平行,,,唉,下次读题要仔细。
#include<bits/stdc++.h>using namespace std;#define LL long long#define pb push_back#define X first#define Y second#define cl(a,b) memset(a,b,sizeof(a))typedef pair<double,double> P;const int maxn=100005;const int inf=1<<27;const LL mod=1e9+7;struct point{ int x,y;}p[5];int main(){ int n; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d%d",&p[i].x,&p[i].y); } int ans=-1; for(int i=0;i<n;i++){ for(int j=0;j<n;j++)if(i!=j){ if(p[i].x!=p[j].x&&p[i].y!=p[j].y){ ans=abs(p[i].x-p[j].x)*abs(p[i].y-p[j].y); } } } printf("%d\n",ans); return 0;}
0 0
- Codeforces Round #331 (Div. 2)A. Wilbur and Swimming Pool(简单计算)
- Codeforces Round #331 (Div. 2) A. Wilbur and Swimming Pool
- Codeforces Round #331 (Div. 2) A. Wilbur and Swimming Pool
- Codeforces Round #331 (Div. 2) A. Wilbur and Swimming Pool (判断组成最大矩形)
- Codeforces Round #331 (Div. 2) _A. Wilbur and Swimming Pool
- Codeforces Round #331 (Div. 2)-Wilbur and Swimming Pool(模拟)
- CodeForces 596A--Wilbur and Swimming Pool
- CodeForces 596A-Wilbur and Swimming Pool
- 【Codeforces Round 331 (Div 2)A】【水题】Wilbur and Swimming Pool 给出矩形1~4个顶点让你还原矩形
- Codeforces--596A--Wilbur and Swimming Pool(数学)
- A. Wilbur and Swimming Pool
- Codeforces 596A Wilbur and Swimming Pool 【水题】
- CodeForces - 596A Wilbur and Swimming Pool (模拟)
- CodeForces 596 A Wilbur and Swimming Pool【数学】
- CodeForces 596A:Wilbur and Swimming Pool【水】
- CF 596A. Wilbur and Swimming Pool 【计算矩形面积】
- CF--A. Wilbur and Swimming Pool
- cf A. Wilbur and Swimming Pool
- 将不规则四边形图像插值成为一个矩形图像
- spring事务
- datasource 配置 removeAbandoned
- 8张图理解Java
- Android项目打包成APK文件
- Codeforces Round #331 (Div. 2)A. Wilbur and Swimming Pool(简单计算)
- hdu 1004 字符串统计
- swift之控制转移语句,continue,break,fallthrough,return,带标签的语句
- Tuple
- 费诺编码C程序及演示结果
- 删除Xcode中多余的证书provisioning profile
- 一分钟认识 Git
- Andorid制作内含控件的自定义布局
- 做一个下拉刷新必须需要掌握的android知识点