Codeforces #261 (Div. 2) A. Pashmak and Garden(水题)
来源:互联网 发布:js 大于等于 小于等于 编辑:程序博客网 时间:2024/05/17 03:57
很水的一道题,给定两个点,判断能否再添加两个点构成一个正方形
只怪这个题数据给的不好,不然肯定可以跪掉一批人
如果把4个x y的范围都限定相同,那这场真的可以成为人生大赢家了
严谨代码如下:
#include <cstdio>#include <iostream>#include <algorithm>#define MAXN 10010#define LL long longusing namespace std;bool judge(int x) { if(x>=-1000 && x<=1000) return true; return false;}int main(void) { int x1, y1, x2, y2, x3, y3, x4, y4, tmp; scanf("%d%d%d%d", &x1, &y1, &x2, &y2); if(x1 == x2) { tmp = abs(y2 - y1); if(judge(x1+tmp)) printf("%d %d %d %d\n", x1+tmp, y1, x1+tmp, y2); else if(judge(x1-tmp)) printf("%d %d %d %d\n", x1-tmp, y1, x1-tmp, y2); else printf("-1\n"); } else if(y1 == y2) { tmp = abs(x2 - x1); if(judge(y1+tmp)) printf("%d %d %d %d\n", x1, y1+tmp, x2, y1+tmp); else if(judge(y1-tmp)) { printf("%d %d %d %d\n", x1, y1-tmp, x2, y1-tmp); } else printf("-1\n"); } else { if(abs(y2-y1) != abs(x2-x1)) printf("-1\n"); else { printf("%d %d %d %d\n", x1, y2, x2, y1); } } return 0;}
0 0
- Codeforces Round #261 (Div. 2) A. Pashmak and Garden (水题)
- Codeforces #261 (Div. 2) A. Pashmak and Garden(水题)
- Codeforces Round #261 (Div. 2) A. Pashmak and Garden
- Codeforces Round #261 (Div. 2) A. Pashmak and Garden【水】
- Codeforces Round #261 (Div. 2) A. Pashmak and Garden
- Codeforces Round #261 (Div. 2)A. Pashmak and Garden
- Codeforces Round #261(Div.2) A. Pashmak and Garden
- Codeforces 459A Pashmak and Garden(水题)
- Codeforces Round #261 (Div. 2)459A. Pashmak and Garden(数学题)
- Codeforces Round #261 (Div. 2)-A. Pashmak and Garden(容易)
- 【CODEFORCES】 A. Pashmak and Garden
- codeforces-#459A Pashmak and Garden
- codeforces 459A. Pashmak and Garden
- Codeforces-459A-Pashmak and Garden
- A. Pashmak and Garden
- A. Pashmak and Garden
- CF 261A. Pashmak and Garden
- CF 261A. Pashmak and Garden
- poj 1674 Sorting by Swapping
- max = (a>b) ? (c>d ? 1 : 2) : 3
- 多线程
- nyist oj 214 单调递增子序列(二) (动态规划经典)
- android的ListView点击item使item展开的做法
- Codeforces #261 (Div. 2) A. Pashmak and Garden(水题)
- Cocos2d-x 3.x 系列教程02-创建自定义项目
- 武帝纪(曹操传)
- 认识LINUX各个版本
- 进程和线程
- cocos2d anchor与moveBy、moveTo
- Web性能测试工具推荐
- 【Kali_001】封装定制、安装与升级
- Flash写特性0xFF---->0x00