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. (转)Visual Studio原生开发的10个调试技巧(二)

    我以前关于Visual Studio调试技巧的文章引起了大家很大的兴趣,以至于我决定分享更多调试的知识.以下的列表中你可以看到写原生开发的调试技巧(接着以前的文章来编号).这些技巧可以应用在VS200 ...

  2. Linux基本命令(8)网络操作的命令

    网络操作命令 命令 功能 命令 功能 ftp 传送文件 telnet 远端登陆 bye 结束连线并结束程序 rlogin 远端登入 ping 检测主机 netstat 显示网络状态 8.1 ftp命令 ...

  3. ID@Xbox计划宣传片 XboxOne喜迎大波小游戏(转)

    微软Xbox One游戏不够多?别担心,微软的ID@Xbox计划将带来一大波独立游戏!微软在今天正式公布了即将登陆旗下的Xbox One主机平台的独立游戏阵容,数量多达32款,官方的宣传片也已放出,感 ...

  4. BPDU与PortFast

    启用了BPDU Guard特性的端口在收到BPDU的时候会使端口进入err-disable状态,从而避免桥接环路.一般BPDU Guard是和PortFast结合使用,在端口上启用了PortFast之 ...

  5. 腾讯2015校招一面、二面、HR面

    其实我目前的理想公司就是腾讯. 内推第三面跪了··· 现在校招. 已面完一面.二面.HR面··· 一面主要问我项目和Linux.网络··· 二面主要问我游戏服务器··· 然后是HR面··· 技术面我都 ...

  6. Chapter6:函数

    执行函数的第一步是(隐式地)定义并初始化它的形参.所以,函数最外层作用域中的局部变量也不能使用与函数形参一样的名字. 局部静态变量:在程序的执行路径第一次经过对象定义语句时初始化,并且直到程序终止才被 ...

  7. MVC同一页面循环显示数据库记录(答题/投票系统)

    ) { //int id = 1; list newlist = db.lists.Find(id); //var q = from p in db.lists where p.id==1 selec ...

  8. java开发eclipse常见问题(一)The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

    最近刚开始用Eclipse开发,刚开始都是按教程一步一步的新建web工程也没出现什么问题. 今天选了一个新的workspace,建了个web工程发现最简单的jsp页面都报错:The superclas ...

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

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

  10. 【转】 ASP.NET网站路径中~(波浪线)解释

    刚开始学习ASP.NET的朋友可能会不理解路径中的-符代表什么,例如ImageUrl=”~/Images/SampleImage.jpg” 现在我们看看-代表什么意思.-是ASP.NET 的Web 应 ...