King's Sanctuary

Time Limit: 20 Sec  Memory Limit: 256 MB

题目连接

http://acm.uestc.edu.cn/#/problem/show/93

Description

The king found his adherents were building four sanctuaries for him. He is interested about the positions of the sanctuaries and wants to know whether they would form a parallelogram, rectangle, diamond, square or anything else.

Input

The first line of the input is T(1≤T≤1000), which stands for the number of test cases you need to solve. Each case contains four lines, and there are two integers in each line, which shows the position of the four sanctuaries. And it is guaranteed that the positions are given clockwise. And it is always a convex polygon, if you connect the four points clockwise.

Output

For every test case, you should output Case #t: first, where t indicates the case number and counts from 1, then output the type of the quadrilateral.

Sample Input

5
0 0
1 1
2 1
1 0
0 0
0 1
2 1
2 0
0 0
2 1
4 0
2 -1
0 0
0 1
1 1
1 0
0 0
1 1
2 1
3 0

Sample Output

Case #1: Parallelogram
Case #2: Rectangle
Case #3: Diamond
Case #4: Square
Case #5: Others

HINT

题意

题解:

给你4个点,让你判断是正方形,还是菱形,还是矩形,还是平行四边形

乱搞就好了 = =

代码:

#include <iostream>
#include <queue>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath> using namespace std; int T, x[], y[]; bool Parallelogram()
{
int a = (y[] - y[]) * (x[] - x[]);
int b = (x[] - x[]) * (y[] - y[]);
if(a != b) return false;
a = (x[] - x[]) * (y[] - y[]);
b = (x[] - x[]) * (y[] - y[]);
return a == b;
} bool Rectangle()
{
int a = (x[] - x[]) * (x[] - x[]) + (y[] - y[]) * (y[] - y[]);
int b = (x[] - x[]) * (x[] - x[]) + (y[] - y[]) * (y[] - y[]);
return a == b;
} bool Diamond()
{
int a = (y[] - y[]) * (y[] - y[]);
int b = (x[] - x[]) * (x[] - x[]);
return a == -b;
} int main()
{
scanf("%d", &T);
for(int ca = ; ca <= T; ca++)
{
int i, j;
for(i = ; i < ; i++)
{
scanf("%d %d", &x[i], &y[i]);
}
printf("Case #%d: ", ca);
for(i = ; i < ; i++)
{
for(j = i + ; j < ; j++)
{
if(x[i] == x[j] && y[i] == y[j])
break;
}
if(j != ) break;
}
if(i != ) puts("Others");
else
{
bool tag, tag1;
tag = Parallelogram();
if(tag == false) {puts("Others");}
else
{
tag = Rectangle();
tag1 = Diamond();
if(tag == false && tag1 == false) puts("Parallelogram");
else if(tag == true && tag1 == true) puts("Square");
else if(tag == true) puts("Rectangle");
else if(tag1 == true) puts("Diamond");
}
}
}
return ;
}

cdoj 93 King's Sanctuary 傻逼几何题的更多相关文章

  1. King's Sanctuary(简单几何)

    King's Sanctuary Time Limit: 1000 ms Memory Limit: 65535 kB Solved: 111 Tried: 840 Submit Status Bes ...

  2. 傻逼Eclipse笔记

    Eclipse 这么傻逼的工具,还有人用,真是奇了怪了. Invalid project description 我想打开SVN 的代码 ,别让我拷到别的地方,怎么破? 正确答案是: 删除 Eclip ...

  3. BZOJ-1625 宝石手镯 01背包(傻逼题)

    傻逼题,懒得打,复制蛋蛋的.. 1625: [Usaco2007 Dec]宝石手镯 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 1076 Solved: ...

  4. Codeforces Gym 100338I TV Show 傻逼DFS,傻逼题

    Problem I. TV ShowTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest ...

  5. BZOJ 2222: [Cqoi2006]猜数游戏【神奇的做法,傻逼题,猜结论】

    2222: [Cqoi2006]猜数游戏 Time Limit: 20 Sec  Memory Limit: 259 MBSubmit: 604  Solved: 260[Submit][Status ...

  6. [BZOJ]4644: 经典傻逼题

    某天我觉得一切题目都是那么不可做,于是百度了一下"傻逼题"-- 题目大意:对于图中的任意一个点集(可以为空或者全集),所有恰好有一个端点在这个点集中的边组成的集合被称为割.一个割的 ...

  7. OI中常犯的傻逼错误总结

    OI中常犯的傻逼错误总结 问题 解决方案 文件名出错,包括文件夹,程序文件名,输入输出文件名  复制pdf的名字  没有去掉调试信息  调试时在后面加个显眼的标记  数组开小,超过定义大小,maxn/ ...

  8. Expo大作战(三十一)--expo sdk api之Payments(expo中的支付),翻译这篇文章傻逼了,完全不符合国内用户,我只负责翻译大家可以略过!

    简要:本系列文章讲会对expo进行全面的介绍,本人从2017年6月份接触expo以来,对expo的研究断断续续,一路走来将近10个月,废话不多说,接下来你看到内容,讲全部来与官网 我猜去全部机翻+个人 ...

  9. 【题解】 bzoj2435: [Noi2011]道路修建 (傻逼题)

    bzoj2435,懒得复制,戳我戳我 Solution: 模拟即可(有点傻逼啊 Code: //It is coded by Ning_Mew on 5.13 #include<bits/std ...

随机推荐

  1. 数学概念 z

    数学是很难的科学,但因为它是科学家用数学来解释宇宙的语言,我们无可避免的要学习它.看看下面的这些 GIF 动图,它们提供了视觉的方式来帮助你理解各种数学技巧. 1.椭圆的画法 2.杨辉三角问题(Pas ...

  2. Masonry 固定宽度 等间距

    -(void)makeEqualDisViews:(NSArray *)views inView:(UIView *)containerView LRpadding:(CGFloat)LRpaddin ...

  3. js与C#服务端 json数据交互

    1.1 服务端返回给前端 返回的数据都放入对象中(根据需求:单个对象,集合,键值对),然后JSON序列化返回给前端.这里可以引用JSON.NET 库,也可以用.NET自带的类库: JavaScript ...

  4. 【转】Linux Page Cache的工作原理

    1 .前言 自从诞生以来,Linux 就被不断完善和普及,目前它已经成为主流通用操作系统之一,使用得非常广泛,它与Windows.UNIX 一起占据了操作系统领域几乎所有的市场份额.特别是在高性能计算 ...

  5. WebGoat学习——跨站请求伪造(Cross Site Request Forgery (CSRF))

    跨站请求伪造(Cross Site Request Forgery (CSRF)) 跨站请求伪造(Cross Site Request Forgery (CSRF))也被称为:one click at ...

  6. 《C陷阱与缺陷》读书笔记

    1. 词法“陷阱” = 不同于 == , 可以通过if( 1 == a )来避免 & | 不同于 && || 词法分析中的“贪心法” 编译器将程序分解成符号的方法是,从左到右一 ...

  7. python中基于descriptor的一些概念

    python中基于descriptor的一些概念(上) 1. 前言 2. 新式类与经典类 2.1 内置的object对象 2.2 类的方法 2.2.1 静态方法 2.2.2 类方法 2.3 新式类(n ...

  8. Web 检测代码 web analysis 开源 open source

    1. Grape Web Statistics Grape Web Statistics is a fairly simple piece of analytics software. Grape i ...

  9. 【Visual Studio2010】创建XAML分析插件

    最近项目[Silverlight]中的需要实现国际化,需要对所有控件进行一个处理.由于使用了Telerik的控件,只需要去掉原有的Label或者Header属性,然后添加一个资源Key即可.但是在项目 ...

  10. Clean Code第二章<命名>

    1.命名要有意义 错误写法 正确写法 2.某些构造函数可以提供有意义的静态方法去实现