hdu 5533 Dancing Stars on Me(水)
来源:互联网 发布:知乎live可以回看吗 编辑:程序博客网 时间:2024/05/22 13:27
题目链接:hdu 5533 Dancing Stars on Me
解题思路
只有n=4时才有可能。
代码
#include <cstdio>#include <cstring>#include <vector>#include <algorithm>using namespace std;const int maxn = 105;struct Point { int x, y; Point (int x = 0, int y = 0): x(x), y(y) {} void read() { scanf("%d%d", &x, &y); } bool operator == (const Point& u) const { return x == u.x && y == u.y; } bool operator < (const Point& u) const { return x < u.x || (x == u.x && y < u.y); } Point operator + (const Point& u) const { return Point(x + u.x, y + u.y); } int operator * (const Point& u) const { return x * u.x + y * u.y; } int operator ^ (const Point& u) const { return x * u.y - y * u.x; }};int N;Point P[maxn];bool judge () { if (N != 4) return false; vector<int> g; g.clear(); for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { int x = P[i].x - P[j].x; int y = P[i].y - P[j].y; g.push_back(x * x + y * y); } } sort(g.begin(), g.end()); for (int i = 1; i < 4; i++) if (g[i] != g[0]) return false; return g[4] == g[5];}int main () { int cas; scanf("%d", &cas); while (cas--) { scanf("%d", &N); for (int i = 0; i < N; i++) P[i].read(); printf("%s\n", judge() ? "YES" : "NO"); } return 0;}
0 0
- hdu 5533 Dancing Stars on Me(水)
- hdu 5533 Dancing Stars on Me
- hdu 5533 Dancing Stars on Me
- HDU 5533 Dancing Stars on Me
- hdu 5533 Dancing Stars on Me
- HDU 5533:Dancing Stars on Me【数学】
- HDU 5533 Dancing Stars on Me
- HDU 5533 Dancing Stars on Me [数学]
- HDU 5533 Dancing Stars on Me
- HDU-5533 Dancing stars on me
- HDU 5533 Dancing Stars on Me(凸包)
- HDU 5533 Dancing Stars on Me(数学+水题)
- HDU 5533 Dancing Stars on Me (凸包)
- HDU 5533 Dancing Stars on Me (暴力模拟+思维)
- HDU Dancing Stars on Me
- Dancing Stars on Me HDU
- HDU杭电5533 Dancing Stars on Me
- HDU-5533-Dancing Stars on Me【2015长春赛区】
- iOS之CocoaPods使用
- MSTest or TRX to HTML with Animated Charts
- Tomcat中文乱码问题的原理和解决方法
- mac终端打开出现问题:[forkpty: Resource temporarily unavailable]
- [Python开发] python使用nltk进行Chart Parsing
- hdu 5533 Dancing Stars on Me(水)
- 【鸟哥的linux私房菜-学习笔记】sed 工具
- Quick Start Guide for Apache Hawq[作者:盛想]
- Android文本输入框EditText方法说明和属性
- java synchronized详解
- mysql的行锁问题
- iOS自定义cell的写法
- 十年研发经验工程师的嵌入式学习书籍大推荐
- [maven2]maven2下pom.xml的json-lib的配置