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. ...
随机推荐
- 删除/var/lib/docker
FATA[0000] Get http:///var/run/docker.sock/v1.18/containers/json?all=1: dial unix /var/run/docker.so ...
- Android Activity模拟dialog
Android项目中很多地方,都会弹出一个弹出框.类似于自己定义的alertDialog,比如微信的退出提示,但由于Dialog的限制,可能不能很完美的实现你的想要的功能,所有研究发现他们这种实现其实 ...
- (转)WPF控件开源资源
(转)WPF控件开源资源 Textbox Drag/Drop in WPFhttp://www.codeproject.com/Articles/42696/Textbox-Drag-Drop-in- ...
- 彻底理解数字图像处理中的卷积-以Sobel算子为例
彻底理解数字图像处理中的卷积-以Sobel算子为例 作者:FreeBlues 修订记录 2016.08.04 初稿完成 概述 卷积在信号处理领域有极其广泛的应用, 也有严格的物理和数学定义. 本文只讨 ...
- Install ssdb-rocks on CentOS 6
Install ssdb-rocks on CentOS 6 C.C. 发表于 2014年08月10日 20:14 | Hits: 649 为了优化节操精选的弹幕系统,打算更换到Facebook的R ...
- php自定义函数call_user_func和call_user_func_array详解
看UCenter的时候有一个函数call_user_func,百思不得其解,因为我以为是自己定义的函数,结果到处都找不到,后来百度了一下才知道call_user_func是内置函 call_user_ ...
- PHP面向对象三大特点学习(充分理解抽象、封装、继承、多态)
PHP面向对象三大特点学习 学习目标:充分理解抽象.封装.继承.多态 面象对向的三大特点:封装性.继承性.多态性 首先简单理解一下抽象:我们在前面定义一个类的时候,实际上就是把一类事物共有的属性和 ...
- 【Hibernate】Hibernate系列3之配置文件详解
配置文件详解 3.1.配置文件 连接池性能优化:http://www.cnblogs.com/xdp-gacl/p/4002804.html
- (int),Int32.Parse() 和 Convert.toInt32() 的区别
在 C# 中,(int),Int32.Parse() 和 Convert.toInt32() 三种方法有何区别? int 关键字表示一种整型,是32位的,它的 .NET Framework 类型为 S ...
- Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative. Example Given 1-> ...