标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 1184 Accepted Submission(s): 651
#include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #include <queue> #include <vector> #include <iomanip> #include <math.h> #include <map> using namespace std; #define FIN freopen("input.txt","r",stdin); #define FOUT freopen("output.txt","w",stdout); #define INF 0x3f3f3f3f #define INFLL 0x3f3f3f3f3f3f3f #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 typedef long long LL; typedef pair<int,int> PII; const int MAXN = 1e2 + 5; int T, n; int a[MAXN], b[MAXN]; double dis[MAXN * MAXN]; int main() { //FIN scanf("%d", &T); while(T--) { scanf("%d", &n); for(int i = 1; i <= n; i++) { scanf("%d%d", &a[i], &b[i]); } int cas = 0; for(int i = 1; i <= n - 1; i++) { for(int j = i + 1; j <= n; j++) { dis[++cas] = (double) sqrt((a[j] - a[i])*(a[j] - a[i]) + (b[j] - b[i])*(b[j] - b[i])); } } sort(dis + 1, dis + cas + 1); // for(int i = 1; i <= cas; i++) { // cout << dis[i] << endl; // } // cout << "cas=" << cas << endl; if(dis[1] == dis[n]) printf("YES\n"); else printf("NO\n"); } return 0; }
HDU 5533 Dancing Stars on Me 计算几何瞎暴力
标签:
原文地址:http://www.cnblogs.com/Hyouka/p/5875299.html