题目链接

 /*
Name:nyoj-1099-Lan Xiang's Square
Copyright:
Author:
Date: 2018/4/26 9:19:19
Description:
给4个点,判断是否形成正方形
double类型的值比较大小,直接判断==0竟然A了,然而小于1e-6竟然WA
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
struct node {
double x, y;
}nodes[];
double length_edge(node a, node b) {
return (b.x - a.x)*(b.x - a.x) + (b.y - a.y)*(b.y - a.y);
}
int main()
{
// freopen("in.txt", "r", stdin);
int t;
cin>>t;
while (t--) {
for (int i=; i<; i++)
cin>>nodes[i].x>>nodes[i].y;
double edge[];
edge[] = length_edge(nodes[], nodes[]);
edge[] = length_edge(nodes[], nodes[]);
edge[] = length_edge(nodes[], nodes[]);
if (count(edge, edge+, ) >) {
cout<<"No"<<endl;
continue;
}
sort(edge, edge+);
// if (edge[0] - edge[2] + edge[1] < 1e-6 && (edge[0] - edge[1]) < 1e-6) { //WA
if (edge[] - edge[] + edge[] == && (edge[] - edge[]) == ) {
cout<<"Yes"<<endl;
} else {
cout<<"No"<<endl;
}
}
return ;
}

nyoj-1099-Lan Xiang's Square(几何,水题)的更多相关文章

  1. ACM: FZU 2110 Star - 数学几何 - 水题

     FZU 2110  Star Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u  Pr ...

  2. UVA 11461 - Square Numbers(水题)

    题目链接 #include <cstdio> #include <cstring> #include <string> #include <cmath> ...

  3. C 几何水题 求不同斜率的数目 枚举+set

    Description Master LU 非常喜欢数学,现在有个问题:在二维空间上一共有n个点,LU每连接两个点,就会确定一条直线,对应有一个斜率.现在LU把平面内所有点中任意两点连线,得到的斜率放 ...

  4. POJ 2002 Squares 几何, 水题 难度: 0

    题目 http://poj.org/problem?id=2002 题意 已知平面内有1000个点,所有点的坐标量级小于20000,求这些点能组成多少个不同的正方形. 思路 如图,将坐标按照升序排列后 ...

  5. zzulioj--1746--三角形面积(几何水题)

    1746: 三角形面积 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 100  Solved: 31 SubmitStatusWeb Board De ...

  6. nyoj--1011--So Easy[II](数学几何水题)

    So Easy[II] 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描述 这是一道基础的计算几何问题(其实这不提示大家也都看的出).问题描述如下: 给你一个N边形.且N边形 ...

  7. nyoj 1208——水题系列——————【dp】

    水题系列 时间限制:1000 ms  |  内存限制:65535 KB 难度:2   描述     给你一个有向图,每条边都有一定的权值,现在让你从图中的任意一点出发,每次走的边的权值必须必上一次的权 ...

  8. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  9. poj 1006:Biorhythms(水题,经典题,中国剩余定理)

    Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 110991   Accepted: 34541 Des ...

随机推荐

  1. gearman管理

    通常,Gearman被用来分发任务,以便实现异步操作.下面捋捋如何管理Gearman. 说明:请自行安装好Gearman和PHP PECL Gearman. (我之前安装的gearman php的c语 ...

  2. 中间件 WSGI

    冒泡程序 array = [1, 2, 5, 3, 6, 8, 4] for i in range(len(array) - 1, 0, -1): print i for j in range(0, ...

  3. java中byte数组与int,long,short间的转换

    http://blog.csdn.net/leetcworks/article/details/7390731 package com.util; /** * * <ul> * <l ...

  4. (转) GIS 中地理坐标和屏幕坐标的标准转换方法

    from :http://www.cnblogs.com/WonKerr/archive/2010/01/01/Coord_Transform.html 在GIS中,当你拿到一个图层的地理坐标后,如果 ...

  5. mtime、atime、ctime基本解释

    不罗嗦 Access time.Modify time.Change time,也就是访问时间.修改时间和状态时间. >修改时间:文件的内容被最后一次修改的时间,我们经常用的ls -l命令显示出 ...

  6. 转:USB枚举

  7. 转:Windows下USB接口驱动技术(一)

  8. win10系统修改Intel VT-x时进入不了BIOS问题

    一般电脑进入BIOS的方式都是在开机的时候不停的按F2或者F12,但是Win10系统由于支持快速启动,当win10系统快速启动的时候,按F12或者F2是没反应的,解决方式: 第一步:修改win10的启 ...

  9. web中的编码问题

    response返回有两种,一种是字节流outputstream,一种是字符流printwrite. 先说字节流,要输出“中国",给输出流的必须是转换为utf-8的“中国”,还要告诉浏览器, ...

  10. JavaScript笔记02——基本语法(包括函数、对象、数组等)

    Doing Math & Logic Conditional & Looping Functions Objects Arrays Doing Math & Logic 1.J ...