ZOJ2748 Free Kick
来源:互联网 发布:我被淘宝拉黑云黑名单 编辑:程序博客网 时间:2024/06/15 23:06
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 103.66 0.5 -5 -20.3 9.15 10
Sample Output
43
#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 0x3f3f3f3fconst 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
- ZOJ2748-Free Kick
- PES 11 FREE KICK
- ZOJ 2748 Free Kick
- ZOJ 2748Free Kick
- Solution of ZOJ 2748 Free Kick
- 10 Free Server & Network Monitoring Tools that Kick Ass
- kick off
- kick off
- Kick off
- kick boll
- kick off
- Master.Kick.
- penalty kick
- free.
- free
- free()
- free
- 讨论哪个博客好?
- java简单字符串排序
- 经典的卷积网络结构:AlexNet,VGGNet,Google Inception Net,ResNet(HR)
- 设计模式--基础知识
- 1015. 德才论 (25)
- ZOJ2748 Free Kick
- CSS样式中的后代选择器和子代选择器
- 1999年分区联赛提高组之一 拦截导弹(dp+贪心C++)
- js原型链
- Hello World
- Android开发 利用imageview显示选取的手机内存的图片
- 学生信息的添加与查询
- PHP如何接受上传的图片并保存到本地
- Python学习5-函数