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. Intellij IDEA开发第一个Android应用

    1.创建一个项目 File——>New Project——>.......——>Finish 2.创建模块 3.MyActivity.java package com.example ...

  2. SNIFFER问题集锦

    SNIFFER相关教程下载: Sniffer使用教程.pdf|Sniffer用法.ppt 具体问题解决: 1.SNIFFER4.75无法使用,打开后提示 No adapter is binding t ...

  3. backbone-1.3.3源码解析-----------Event

    第一次写,写的不对的请指正 backbone.js中的Event实现了自定义事件.自定义事件就是一个对象的键值对,key为事件名,value为一个function数组.在backbone这个对象中有一 ...

  4. 【转】asp.net发布到IIS中出现错误:处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”

    原文:http://blog.csdn.net/mazhaojuan/article/details/7660657 开发web项目时需要安装IIS,在安装好IIS的Windows7本上发布asp.n ...

  5. spark connect to Cassandra problem

    Cassandra rowkey is Blob type, cannot select by spark. How?

  6. MFC中TRACE

    错误 1 error C1189: #error :  Building MFC application with /MD[d] (CRT dll version) requires MFC shar ...

  7. 代理(Proxy)模式简介

    Proxy 模式简介 代理模式的两个应用: 打开文档时加载大图片 例如:如果有个对象是一张很大的图片,而这张图片需要花费很长时间才能显示出来,那么当这个图片包含在文档中的后面时,使用编辑器或浏览器打开 ...

  8. NServiceBus-架构的原则

    自主性和松散耦合在设计时和运行时都是没有的事,任何技术都可以给你. 面向服务的架构(SOA)和事件驱动的体系结构提供了依据识别使用nservicebus. 战略领域驱动设计有助于弥合业务/IT鸿沟和驱 ...

  9. ZOJ-3201 Tree of Tree 树形DP

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3201 题意:给一颗树,每个节点有一个权值,求节点数为n的最大权子 ...

  10. 第二百零四天 how can i 坚持

    我应该不会看错吧.最近媒体热炒小米衰落了,有必要那么大张旗鼓的报道吗?小米.华为,坚决看好小米.感觉华为品牌有些杂乱,在走三星的老路,小米有些苹果的影子,但是,多了个互联网.互联网... 未来孰优孰劣 ...