Free Kick


Time Limit: 2 Seconds      Memory Limit: 65536 KB


In a soccer game, a direct free kick is also awarded to the opposing team if a player commits any of the offences.

A direct free kick in an immediate distance is a nightmare of the goalie. In order to help their goalkeeper, the defenders often choose to stand side by side between the free kick position
and the goal, just like a straight "WALL". The goalkeeper expects the "WALL" can receive the shooting angle as much as possible. However, there are only 11 players in a team and some of them must pay attention to other offenders, so the defenders to make up
the "WALL" are quite limited.

Let's make the problem easier on a simplified field map, shown as above. The two ends of the goal locate at (-a,0) and (a,0) respectively, and the free kick position
is (x, y). Assuming the body width of every defender is always W, your task is to determine how many defenders are required at the least to make up the "WALL", so that they can help their goalie receive the shooting angle. According to FIFA's
law, all the defender must keep a distance not less than D from the free kick position. The goalie will feel safe if the remaining shooting angle after the "WALL" is strictly less than A degree.

Input

The input consists of several test cases. In each case, there are six numbers in a single line, indicating aWxyD and A respectively.

Constraints:

  • aWDA are all positive numbers;
  • The distance between the goal and the free kick position is guaranteed greater than D;
  • The absolute value of each non-zero number is in the range [10-6, 106].

Proceed until the end of file.

Output

For each case, print an integral number on a single line, which denotes the minimal number of defenders is required to make the goalie safe. Note that this number may be greater than
11.

Sample Input

3.66 0.5 5 20.2 9.15 10
3.66 0.5 -5 -20.3 9.15 10

Sample Output

4
3

——————————————————————————————————————
题目的意思是给出射手位置和球门位置,防守人员宽度和距离射手最小距离及最大角度,求最少安排几个人
我们可以清楚知道,把人安排在角平分上收益最大,所以先余弦定理算出射手与门框两侧夹角,在通过边角关系算出答案。

注意:所给最大角度可能已经比射手与门框两侧夹角大了,这样导致算出的人可能是负的,取0

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <functional>
#include <bitset>
#include <string> using namespace std; #define LL long long
#define INF 0x3f3f3f3f
const double pi=acos(-1.0); struct point
{
double x,y;
}; double dis(point v1,point v2)
{
return sqrt((v1.x-v2.x)*(v1.x-v2.x)+(v1.y-v2.y)*(v1.y-v2.y));
} int main()
{
double a,W,D,A;
point v1,v2,u;
while(~scanf("%lf%lf%lf%lf%lf%lf",&a,&W,&u.x,&u.y,&D,&A))
{
A=A/180*pi;
v1.x=-a,v1.y=0;
v2.x=a,v2.y=0;
double X=dis(u,v1);
double Y=dis(u,v2);
double Z=dis(v1,v2);
double B= acos((X*X+Y*Y-Z*Z)/(2*X*Y));
double C=(B-A)/2;
double w=D*tan(C);
w*=2;
int ans=ceil(w/W);
printf("%d\n",max(ans,0));
}
return 0;
}



ZOJ2748 Free Kick 2017-04-18 20:40 40人阅读 评论(0) 收藏的更多相关文章

  1. 灰度世界算法(Gray World Algorithm) 分类: 图像处理 Matlab 2014-12-07 18:40 874人阅读 评论(0) 收藏

    人的视觉系统具有颜色恒常性,能从变化的光照环境和成像条件下获取物体表面颜色的不变特性,但成像设备不具有这样的调节功能, 不同的光照环境会导致采集的图像颜色与真实颜色存在一定程度的偏差,需要选择合适的颜 ...

  2. Tautology 分类: POJ 2015-06-28 18:40 10人阅读 评论(0) 收藏

    Tautology Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10428   Accepted: 3959 Descri ...

  3. HDU 2042 不容易系列之二 [补6.24] 分类: ACM 2015-06-26 20:40 9人阅读 评论(0) 收藏

    不容易系列之二 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Su ...

  4. 《大型网站技术架构》1:概述 分类: C_OHTERS 2014-05-07 20:40 664人阅读 评论(0) 收藏

    参考自<大型网站技术架构>第1~3章 1.大型网站架构演化发展历程 (1)初始阶段的网站架构:一台服务器分别作为应用.数据.文件服务器 (2)应用服务和数据服务分离:三台服务器分别承担上述 ...

  5. 高质量C++C编程指南笔记 标签: c++笔记 2015-11-22 20:59 179人阅读 评论(0) 收藏

    1.  在多重循环中,如果有可能,应当将最长的循环放在最内层,最短的循环放在最外层,以减少 CPU 跨切循环层的次数. 2.  如果循环体内存在逻辑判断,并且循环次数很大,宜将逻辑判断移到循环体的外面 ...

  6. hadoop调优之一:概述 分类: A1_HADOOP B3_LINUX 2015-03-13 20:51 395人阅读 评论(0) 收藏

    hadoop集群性能低下的常见原因 (一)硬件环境 1.CPU/内存不足,或未充分利用 2.网络原因 3.磁盘原因 (二)map任务原因 1.输入文件中小文件过多,导致多次启动和停止JVM进程.可以设 ...

  7. Codeforces812B Sagheer, the Hausmeister 2017-06-02 20:47 85人阅读 评论(0) 收藏

    B. Sagheer, the Hausmeister time limit per test 1 second memory limit per test 256 megabytes input s ...

  8. 各种排序算法的分析及java实现 分类: B10_计算机基础 2015-02-03 20:09 186人阅读 评论(0) 收藏

    转载自:http://www.cnblogs.com/liuling/p/2013-7-24-01.html 另可参考:http://gengning938.blog.163.com/blog/sta ...

  9. Ombrophobic Bovines 分类: POJ 图论 最短路 查找 2015-08-10 20:32 2人阅读 评论(0) 收藏

    Ombrophobic Bovines Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 16539 Accepted: 3605 ...

  10. Self Numbers 分类: POJ 2015-06-12 20:07 14人阅读 评论(0) 收藏

    Self Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 22101   Accepted: 12429 De ...

随机推荐

  1. Linux环境kafka安装

    一. 安装包下载地址 https://www.apache.org/dyn/closer.cgi?path=/kafka/2.0.0/kafka_2.12-2.0.0.tgz 注:下载kafka时有S ...

  2. Oracle 表空间查询与操作方法

    一.查询篇 1.查询oracle表空间的使用情况 select b.file_id 文件ID,  b.tablespace_name 表空间,  b.file_name 物理文件名,  b.bytes ...

  3. String..lastIndexOf(".") 返回-1的思考

    String s = tableName.substring(tableName.lastIndexOf(".") + 1); 如果有tableName有'.',那么返回正确的截取 ...

  4. mac电脑安装selenium 记录

    1.使用终端去命令安装 sudo easy_install selenium 参考:https://www.cnblogs.com/nichoc/p/5543654.html 2.听说驱动放在 /us ...

  5. java web 程序---javabean实例--登陆界面并显示用户名和密码

    重点:注意大小写,不注意细节,这点小事,还需要请教 发现一个问题,也是老师当时写的时候,发现代码没错,但是就是运行问题. 大家看,那个java类,我们要求是所有属性均为私有变量,但是方法为公有的,如果 ...

  6. migrating-vcenter-database-express-to-sql-2008-r2

    migrating-vcenter-database-express-to-sql-2008-r2 一.      准备环境. ESXi5.0主机      IP:192.168.1.158      ...

  7. windows下手动安装pyinstaller(python2.7)

    1.首先,安装python2.7.13,官网下载msi版(windows直接安装): https://www.python.org/downloads/ 2.然后,到python包官网依次下载,fut ...

  8. Ubuntu安装Chrome过程中的细节

    Ubuntu中的默认浏览器是Firefox,但是一直以来都认为Chrome更加优秀.下面记录一下在Ubuntu下安装Chrome的过程,也回顾一下Ubuntu系统中的一些细节. 大多数Linux安装软 ...

  9. 8 MySQL--单表查询

    单表查询: http://www.cnblogs.com/linhaifeng/articles/7267592.html 1.单表查询的语法 2.关键字的执行优先级(重点) 3.简单查询 4.whe ...

  10. pandas dataframe.apply() 实现对某一行/列进行处理获得一个新行/新列

    重点:dataframe.apply(function,axis)对一行或一列做出一些操作(axis=1则为对某一列进行操作,此时,apply函数每次将dataframe的一行传给function,然 ...