传送门: http://codeforces.com/problemset/problem/598/C Nearest vectors time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given the set of vectors on the plane, each of them starting at…
这题对精度要求很高.用atan2吧... #include<iostream> #include<cstring> #include<cmath> #include<algorithm> #include<cstdio> using namespace std; +; int n; struct X { long double x,y; long double k; int id; }s[maxn]; bool cmp(const X&a…
题目链接: C. Nearest vectors time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given the set of vectors on the plane, each of them starting at the origin. Your task is to find a pair of…
Partial Tree Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/598/problem/C Description You are given the set of vectors on the plane, each of them starting at the origin. Your task is to find a pair of vectors with the mini…
题目链接:http://codeforces.com/problemset/problem/598/C 题意是给你一个数n,下面n行,每行给你横坐标x和纵坐标y(x != 0 && y != 0).求当两个点与原点形成的角度最小时,是哪两个点. 先介绍atan2这个函数,atan2(double y,double x) 其中y代表已知点的Y坐标 同理x ,返回值是此点与远点连线与x轴正方向的夹角,这样它就可以处理四个象限的任意情况了,它的值域相应的也就是-180~180了. 我觉得最好还是…
Problem C. ICPC GiveawaysTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/attachments Description During the preparation for the ICPC contest, the organizers prepare bags full of giveaways for the contestants. Each bag us…
题目链接:http://codeforces.com/contest/558/problem/E E. A Simple Task time limit per test5 seconds memory limit per test512 megabytes inputstandard input outputstandard output   This task is very simple. Given a string S of length n and q queries each qu…
链接:https://codeforces.com/problemset/problem/1284/E 题意:平面上有n个点,问你存在多少组四个点围成的四边形 严格包围某个点P的情况.不存在三点共线. 思路:首先看数据范围是2500,可以做n^2的枚举,我们可以枚举两遍n.正面求解有些困难,反面求解可以考虑有多少组子集不满足题目要求,拿总的子集数量减去不满足的就是答案. 那么考虑不满足题意的点集. 首先如果对于一对点P和P1,让它们连线,以P为基准,相对度数为0度,枚举P和P1这个条线以上的所有…
题目链接: C. Vectors time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output At a geometry lesson Gerald was given a task: to get vector B out of vector A. Besides, the teacher permitted him to perform…
Alyona and Mex 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/B Description Someone gave Alyona an array containing n positive integers a1, a2, ..., an. In one operation, Alyona can choose any element of the array and decrease it, i.e. re…