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 ...
随机推荐
- Bootstrap-Plugin:提示工具(Tooltip)插件
ylbtech-Bootstrap-Plugin:提示工具(Tooltip)插件 1.返回顶部 1. Bootstrap 提示工具(Tooltip)插件 当您想要描述一个链接的时候,提示工具(Tool ...
- oracle to_date函数和mysql DATE_FORMAT函数用法
一.在Oracle中,当想把字符串为‘2011-09-20 08:30:45’的格式转化为日期格式,我们可以使用oracle提供的to_date函数. sql语句为: SELECT to_date(' ...
- javascript 判断空数组
javascript里判断空数组不能用 []==[] 这样来判断,因为数组也是个对象,普通对象通过指针指向的内存中的地址来做比较 所以 []==[]结果为false,因此判断数组是否为空 用 [].l ...
- 十.jQuery源码分析之.map()
763行:三个参数. elems:待遍历的数组或对象. callback:回调函数,会在数组的每个元素或对象的每个属性上执行.执行时传入两个参数:数组元素,元素下标;或属性名,属性值. arg:仅限于 ...
- 细说Cookie(转)
原文地址:http://www.cnblogs.com/fish-li/archive/2011/07/03/2096903.html#undefined Cookie虽然是个很简单的东西,但它又是W ...
- lambda架构简介
1.Lambda架构背景介绍 Lambda架构是由Storm的作者Nathan Marz提出的一个实时大数据处理框架.Marz在Twitter工作期间开发了著名的实时大数据处理框架Storm,Lamb ...
- Sqoop导入关系数据库到Hive
参考:segmentfault.com:Sqoop导入关系数据库到Hive Sqoop 是 apache 下用于 RDBMS 和 HDFS 互相导数据的工具.本文以 mysql 数据库为例,实现关系数 ...
- Mock.js开发中拦截Ajax
Mock.js 是一款前端开发中拦截Ajax请求再生成随机数据响应的工具.可以用来模拟服务器响应. 优点是非常简单方便, 无侵入性, 基本覆盖常用的接口数据类型. 在我们的生产实际中,后端的接口往往是 ...
- 记一次为gitlab启用CI的过程
问题描述: 在局域网内搭了了一个gitlab,最近有需求要用CI 那时我不在 ,他们尝试了一段时间的Jenkins,但是还没有成功,我说gitlab已经有这些功能了,不用那个.于是一个人搞起来了. 从 ...
- GBDT,Adaboosting概念区分 GBDT与xgboost区别
http://blog.csdn.net/w28971023/article/details/8240756 ============================================= ...