ZOJ2748 Free Kick 2017-04-18 20:40 40人阅读 评论(0) 收藏
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 a, W, x, y, D and A respectively.
Constraints:
- a, W, D, A 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
- #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) 收藏的更多相关文章
- 灰度世界算法(Gray World Algorithm) 分类: 图像处理 Matlab 2014-12-07 18:40 874人阅读 评论(0) 收藏
人的视觉系统具有颜色恒常性,能从变化的光照环境和成像条件下获取物体表面颜色的不变特性,但成像设备不具有这样的调节功能, 不同的光照环境会导致采集的图像颜色与真实颜色存在一定程度的偏差,需要选择合适的颜 ...
- Tautology 分类: POJ 2015-06-28 18:40 10人阅读 评论(0) 收藏
Tautology Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10428 Accepted: 3959 Descri ...
- 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 ...
- 《大型网站技术架构》1:概述 分类: C_OHTERS 2014-05-07 20:40 664人阅读 评论(0) 收藏
参考自<大型网站技术架构>第1~3章 1.大型网站架构演化发展历程 (1)初始阶段的网站架构:一台服务器分别作为应用.数据.文件服务器 (2)应用服务和数据服务分离:三台服务器分别承担上述 ...
- 高质量C++C编程指南笔记 标签: c++笔记 2015-11-22 20:59 179人阅读 评论(0) 收藏
1. 在多重循环中,如果有可能,应当将最长的循环放在最内层,最短的循环放在最外层,以减少 CPU 跨切循环层的次数. 2. 如果循环体内存在逻辑判断,并且循环次数很大,宜将逻辑判断移到循环体的外面 ...
- hadoop调优之一:概述 分类: A1_HADOOP B3_LINUX 2015-03-13 20:51 395人阅读 评论(0) 收藏
hadoop集群性能低下的常见原因 (一)硬件环境 1.CPU/内存不足,或未充分利用 2.网络原因 3.磁盘原因 (二)map任务原因 1.输入文件中小文件过多,导致多次启动和停止JVM进程.可以设 ...
- 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 ...
- 各种排序算法的分析及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 ...
- Ombrophobic Bovines 分类: POJ 图论 最短路 查找 2015-08-10 20:32 2人阅读 评论(0) 收藏
Ombrophobic Bovines Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 16539 Accepted: 3605 ...
- Self Numbers 分类: POJ 2015-06-12 20:07 14人阅读 评论(0) 收藏
Self Numbers Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22101 Accepted: 12429 De ...
随机推荐
- php日志函数error_log
php内置打印log日志的函数,这个对php程序调试非常高效 1.配置 编辑php.ini文件 log_errors = On 设置log日志存储路径 error_log = /wwwroot/php ...
- VS工具相关内容
1.VS自带的Visual Studio中的<C# 语言规范>安装路径:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC#\Sp ...
- [经验]PLSQL乱码解决
本文摘自:http://jingyan.baidu.com/article/36d6ed1f2861f41bcf488327.html @echo off set path=D:\Program Fi ...
- 基础html和css知识
No1.HTML 1.网页结构 网页结构一般都包含文档声明DOCTYPE,并且在head中的meta应该包含编码格式.关键字.网页描述信息.简单格式如下: <!DOCTYPE html> ...
- 解决Linux下MySQL登录ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor)问题
两种方案: 一: 1.修改mysql配置文件:vim /etc/my.cnf 2.找到[mysqld]下添加 skip-grant-tables 配置 3.重启服务service mysqld res ...
- Nginx实战入门教程
Nginx 简介 Nginx是一个高性能的http和反向代理服务器,它看起来好像不太符合英文单词的拼写习惯,因为Nginx是由名为 伊戈尔·赛索耶夫 的俄罗斯人开发的.Nginx主要特点为占用内存小, ...
- django-admin:command not found的解决办法
django-admin:command not found的解决办法 找到django-admin的路径 绝对路径 然后用命令行运行 python3 /usr/local/python3/lib/ ...
- MVC框架介绍
第一,建立一个解决方案然后在该解决方案下面新建mvc空项目. 第二,下面先对该项目的一些文件进行介绍: MVC项目文件夹说明: 1.(App_Data):用来保存数据文件,比如XML文件等 2.(Ap ...
- 什么是Emit,什么是反射,二者区别到底是什么?(转)
Emit的准确定义,我们看看微软给出的答案 System.Reflection.Emit 命名空间包含{ 允许编译器或工具发出元数据和发出 Microsoft 中间语言 (MSIL) ,并可选择在磁盘 ...
- leetcode: Longest Valid Parentheses分析和实现
题目大意:给出一个只包含字符'('和')'的字符串S,求最长有效括号序列的长度. 很有趣的题目,有助于我们对这种人类自身制定的规则的深入理解,可能我们大多数人都从没有真正理解过怎样一个括号序列是有效的 ...