ural 1246. Tethered Dog
1246. Tethered Dog
Memory limit: 64 MB
Input
Output
Sample
| input | output |
|---|---|
4 |
cw |
Problem Source: Ural State University Personal Programming Contest, March 1, 2003
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <ctime>
#include <iomanip>
using namespace std;
typedef long long LL;
typedef double DB;
#define For(i, s, t) for(int i = (s); i <= (t); i++)
#define Ford(i, s, t) for(int i = (s); i >= (t); i--)
#define Rep(i, t) for(int i = (0); i < (t); i++)
#define Repn(i, t) for(int i = ((t)-1); i >= (0); i--)
#define rep(i, x, t) for(int i = (x); i < (t); i++)
#define MIT (2147483647)
#define INF (1000000001)
#define MLL (1000000000000000001LL)
#define sz(x) ((int) (x).size())
#define clr(x, y) memset(x, y, sizeof(x))
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define ft first
#define sd second
#define mk make_pair
inline void SetIO(string Name)
{
string Input = Name+".in",
Output = Name+".out";
freopen(Input.c_str(), "r", stdin),
freopen(Output.c_str(), "w", stdout);
} inline int Getint()
{
int Ret = ;
char Ch = ' ';
bool Flag = ;
while(!(Ch >= '' && Ch <= ''))
{
if(Ch == '-') Flag ^= ;
Ch = getchar();
}
while(Ch >= '' && Ch <= '')
{
Ret = Ret * + Ch - '';
Ch = getchar();
}
return Flag ? -Ret : Ret;
} const int N = ;
struct Point
{
DB x, y;
inline void Read()
{
scanf("%lf%lf", &x, &y);
}
} Arr[N];
int n; inline void Input()
{
scanf("%d", &n);
For(i, , n) Arr[i].Read();
} inline DB Det(const Point &A, const Point &O, const Point &B)
{
DB X1 = A.x - O.x, X2 = B.x - O.x;
DB Y1 = A.y - O.y, Y2 = B.y - O.y;
return X1 * Y2 - X2 * Y1;
} inline void Solve()
{
int p = ;
For(i, , n)
if(Arr[i].x > Arr[p].x) p = i;
Arr[] = Arr[n], Arr[n + ] = Arr[];
if(Det(Arr[p - ], Arr[p], Arr[p + ]) >= 0.0) puts("cw");
else puts("ccw");
} int main()
{
#ifndef ONLINE_JUDGE
SetIO("E");
#endif
Input();
Solve();
return ;
}
ural 1246. Tethered Dog的更多相关文章
- AC日记——丑数 codevs 1246
1246 丑数 USACO 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond 题解 查看运行结果 题目描述 Description 对于一给定的素 ...
- [ZigBee] 12、ZigBee之看门狗定时器——饿了就咬人的GOOD DOG
引言:硬件中的看门狗,不是门卫的意思,而是一只很凶的狗!如果你不按时喂它,它就会让系统重启!这反而是我们想要的功能~ 1.看门狗概述 看门狗定时器(WDT,Watch Dog Timer)是单片机的一 ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2073. Log Files
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...
- ural 2070. Interesting Numbers
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...
- ural 2069. Hard Rock
2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...
- ural 2068. Game of Nuts
2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...
- ural 2067. Friends and Berries
2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. ...
随机推荐
- java笔记--反射机制之基础总结与详解
一.反射之实例化Class类的5种方式: java的数据类型可以分为两类,即引用类型和原始类型(即基本数据类型). 对于每种类型的对象,java虚拟机会实例化不可变的java.lang.Class对象 ...
- 关于seajs
(这些文章都是从我的个人主页上粘贴过来的,大家也可以访问我的主页 www.iwangzheng.com) 最近经常听到各种JS前缀的名称,瞬间感觉自己弱爆了,啥都没用过呢,这么下去将来怎么嫁人呢. ...
- scrapy和selenium结合抓取动态网页
1.安装python (我用的是2.7版本的) 2.安装scrapy: 详情请参考 http://blog.csdn.net/wukaibo1986/article/details/8167590 ...
- linux 下查看某个端口是否被占用
lsof -i:端口号 转自: http://my.oschina.net/u/193184/blog/146885
- Fast Power
Calculate the a^n % b where a, b and n are all 32bit integers. Example For 2^31 % 3 = 2 For 100^1000 ...
- 74 使用BitSet输出数组中的重复元素
[本文链接] http://www.cnblogs.com/hellogiser/p/using-bitset-to-print-duplicate-elements-of-array.html [题 ...
- DisJSet:Wireless Network(POJ 2236)
无线电网络 题目大意:就是地震后,所有的电脑都坏了,现在可以修复,而且要重新连成一个网络,两台电脑之间最大连接距离为D,两台电脑可以有中继电脑,按O修复电脑,按S测试两台电脑是否有链接,如果有就输 ...
- 项目总结(五)--- 界面调试工具Reveal
在开发中,我们也许会碰到以下需求:对于一些动态复杂的交互界面,手码去制定界面是常有的事情,然而我们在开发中想修改过一些参数后想看下实时效果,只能重新运行项目,进入到对应的页面来进行修改,是不是有点麻烦 ...
- MFC基于Dialog的工程中使用OSG
osg的例子有osgviewerMFC,是MDI类型的MFC工程,我一般用基于对话框的MFC较多. 注意观察MFC_OSG.h文件中的cOSG构造函数,参数是一个窗口句柄hWnd,这里的窗口可以不只局 ...
- css3学习总结8--CSS3 3D转换
3D 转换 1. rotateX() 2. rotateY() otateX() 方法 通过 rotateX() 方法,元素围绕其 X 轴以给定的度数进行旋转. 示例: div { transform ...