H. Mysterious Photos

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/gym/100187/problem/H

Description

Everyone probably heard the rumours about the constellation of Bermuda Triangle: any person who looks to this constellation of three stars is said to disappear completely. Though, it's not clear who then spreads these rumours.

Recently two photos have been sent to the editorial office of the newspaper you work on. Each photo depicts three glowing points on the dark background. The note applied to the photos indicates that they are the photos of the constellation of the Bermuda Triangle.

Of course, the editors cannot check if it's true without the risk of the stuff. But at least it is possible to make sure that each photo depicts the same triple of stars. Remember that photos could be taken with the different zoom and rotation. They could also be taken with the help of a mirror in order to decrease the risk of triggering the curse.

As a regular programmer of the newspaper you have the task to determine if these photos can depict the same triple of stars.

Input

The input consists of 6 lines. Each of the first three lines contains two integers separated by space — the coordinates of stars on the first photo. Each of the next three lines also contains two integers — the coordinates of stars on the second photo. All coordinates are between  - 104 and 104, inclusively. Stars on each photo don't coincide and don't lie on the same line.

Output

Output «YES» if the photos can depict the same triple of stars and «NO» otherwise.

Sample Input

0 0
0 2
1 0
0 0
0 4
2 0

Sample Output

YES

HINT

题意

给你俩三角形,问你是否相似

题解:

就问你是否相似……

代码

#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
#define maxn 2001001
#define mod 1000000009
#define eps 1e-9
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//**************************************************************************************
struct node
{
double x,y;
}; double dis(node a,node b)
{
return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
node a[];
node b[];
int main()
{
for(int i=;i<;i++)
cin>>a[i].x>>a[i].y;
for(int i=;i<;i++)
cin>>b[i].x>>b[i].y; double aa[];
double bb[];
int step=;
for(int i=;i<;i++)
for(int j=i+;j<;j++)
aa[step++]=dis(a[i],a[j]);
step=;
for(int i=;i<;i++)
for(int j=i+;j<;j++)
bb[step++]=dis(b[i],b[j]); sort(aa,aa+);
sort(bb,bb+);
int flag=;
if(aa[]/bb[]==aa[]/bb[]&&aa[]/bb[]==aa[]/bb[])
flag=;
if(flag)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl; }

codeforces Gym 100187H H. Mysterious Photos 水题的更多相关文章

  1. codeforces Gym 100500H H. ICPC Quest 水题

    Problem H. ICPC QuestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/a ...

  2. Codeforces Gym 100269A Arrangement of Contest 水题

    Problem A. Arrangement of Contest 题目连接: http://codeforces.com/gym/100269/attachments Description Lit ...

  3. Codeforces Gym 100513F F. Ilya Muromets 水题

    F. Ilya Muromets Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/probl ...

  4. codeforces 707A A. Brain's Photos(水题)

    题目链接: A. Brain's Photos 题意: 问是黑白还是彩色; 思路: 没有思路: AC代码: #include <iostream> #include <cstdio& ...

  5. codeforces 637A A. Voting for Photos(水题)

    题目链接: A. Voting for Photos time limit per test 1 second memory limit per test 256 megabytes input st ...

  6. 【Codeforces 707A】Brain's Photos 水题

    黑白灰都是#Black&White #include <cstdio> int n,m; int main() { scanf("%d%d",&n,&a ...

  7. Codeforces Round #368 (Div. 2) A. Brain's Photos 水题

    A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...

  8. Codeforces Gym 100269B Ballot Analyzing Device 模拟题

    Ballot Analyzing Device 题目连接: http://codeforces.com/gym/100269/attachments Description Election comm ...

  9. Educational Codeforces Round 7 B. The Time 水题

    B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...

随机推荐

  1. OSX 10.10安装教程。

    现在苹果已经放出了OS X 10.9 Mavericks第一个开发者预览版,从Mac App Store中获得的安装程序,可以在10.8的系统中直接进行升级,原有文件都会保留.但是要想制作成一个10. ...

  2. PDF数据提取------3.解析Demo

    1.PDF中文本字符串格式中关键值信息抓取(已完成) 简介:这种解析比较传统最简单主要熟练使用Regular Expression做语义识别和验证.例如抓取下面红色圈内关键信息 string mett ...

  3. 经典非原创,网页常用Javascript

    网页常用Javascript 1.让文字不停地滚动 <MARQUEE>滚动文字</MARQUEE> 2.记录并显示网页的最后修改时间 <script language=J ...

  4. Chapter9:顺序容器

    现代C++程序应该使用标准库容器,而不是更原始的数据结构,例如内置数组. 新标准库容器的性能几乎肯定与最精心优化过的同类数据结构一样好. 当我们用一个对象来初始化容器时,或将一个对象插入到容器中时,实 ...

  5. Hadoop2.2.0 手动切换HA环境搭建

    ssh-copy-id -i hadoop5含义: 节点hadoop4上执行ssh-copy-id -i hadoop5的含义是把hadoop4上的公钥id_rsa.pub的内容追加到hadoop5的 ...

  6. 关于ES6扩展属性

    ES6 let和const let命令 只在代码块作用域内有效 不存在变量提升(不能在申明之前赋值) 暂时性死区(在区域内不受外部变量影响) 不允许重复申明(在相同代码块区域内) 块级作用域 let为 ...

  7. HDU ACM 1050 Moving Tables

    Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a buildin ...

  8. UVALive 5886 The Grille (模拟)

    The Grille 题目链接: http://acm.hust.edu.cn/vjudge/problem/26634 Description http://7xjob4.com1.z0.glb.c ...

  9. rdlc Report Viewer Configuration Error

    主要是web.config没有配置 方法参考http://msdn.microsoft.com/zh-cn/library/ms251661.aspx

  10. USB枚举过程(1)

    总的过程 ① host检测到device,reset 获取设备描述符 host发获取设备描述符请求 ->setup ->data0 <-ack Divice 返回设备描述符 -> ...