Codeforces gym 101149 K 想法
来源:互联网 发布:淘宝买到假货已经下架 编辑:程序博客网 时间:2024/05/17 00:11
One fairy king hated dragons to death. He gathered a big army and killed every single one of them. But he overlooked a small dragon egg, thinking it was a stone, and the last dragon hatched from this egg soon. Quickly determined who is responsible of the genocide of dragons, the last dragon got angry and destroyed all the kingdom. There was no army to defend from him as it was all spent to annihilate other dragons.
A fairy kingdom is a coordinate plane. The king with the remains of his army took shelter in a palace located in the point . The palace is securely defended, and the dragon can't destroy it. Realized that, the dragon hid in the point , hoping to attack the king when he comes out of the palace. The king soon learned where the dragon is hiding and tries to estimate the danger of the situation.
If the king is out of the palace, the dragon can notice it at any moment and fly towards him from his lair. It will be spotted by the king's guards immediately, and the king will immediately move straight to the palace, uniformly, until he gets safe behind its walls. The dragon is looking for revenge, so every moment of time he uniformly moves straight to the current king's location. The king is quite old, while the dragon is full of strength, so the speed of the king is twice slower than the speed of the dragon. The king wants to estimate to what extent the dragon infringes the freedom of his movements, so he would like to know the area of the safe part of the plane, where he can walk without fears that the dragon can catch him earlier than he reaches the palace.
The first line contains two space-separated integers: xp and yp ( - 1000 ≤ xp, yp ≤ + 1000) — the coordinates of the palace.
The second line contains two space-separated integers: xd and yd ( - 1000 ≤ xd, yd ≤ + 1000) — the coordinates of the dragon's lair.
These two points don't coincide.
Output a single floating-point number — the area of the safe part of the plane. The absolute of relative error must not exceed 10 - 6.
0 01 0
0.916297857297023
题意:宫殿的坐标 龙的坐标 龙的速度是国王的速度两倍 而且龙只会向国王所在的方向走 现在问有多少面积是安全的
一个点定义是安全的 国王回到宫殿 龙追不上他
题解:这是套路题
想想看 这个题坐标是没意义的 只有龙和宫殿的距离有用
当左边伸展k倍时 所有图形的面积会变成k^2
开始的距离是1
那么答案就是 k^2*样例答案
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<vector> #include<cmath>using namespace std;#define pi acos(-1.0)int main(){int a,b;int x,y;cin>>a>>b>>x>>y; int dis=(a-x)*(a-x)+(b-y)*(b-y);printf("%.15f\n",(double)dis*(0.916297857297023));return 0;}
- Codeforces gym 101149 K 想法
- Codeforces gym 101102 K 想法
- Codeforces gym 101149 G 想法
- Codeforces gym 101350F 想法
- codeforces [Gym-100814K]
- codeforces Gym 101341 K Competitions
- Codeforces Gym 100792K King's Rout
- Codeforces Gym 101142 K. King's Heir
- Codeforces Gym 101484 K Counting Good Teams
- Codeforces Gym 100203D Different vectors 想法题 + Hash
- Codeforces Gym 100623K Problem K. Key to Success
- [杂题] Codeforces Gym 101190 NEERC 16 K. Kids Designing Kids
- Codeforces Gym 101173 K. Key Knocking (构造)
- Codeforces Gym 101164 K. Cutting (字符串 HASH)
- Codeforces Gym 101174 K. Balls and Needles (DFS)
- 【Codeforces Gym
- 【codeforces Gym
- codeforces Gym
- android studio 新建assets 文件夹
- 索引的使用
- 安卓开发 切换简繁体
- Java常用类之【八种基本数据类型】
- IDEA2016.2.4 安装Python
- Codeforces gym 101149 K 想法
- poj 3624 Charm Bracelet
- Android Opengl ES2.0 -实现RGB-YUV互转并显示到屏幕
- 关于人生中的第一篇博客需要注意的一些事情
- 存储过程、存储函数、内部函数三者的区别与联系
- 覆盖索引
- C++类中的static成员学习总结
- 使用call、apply和bind解决js中烦人的this,事件绑定时的this和传参问题
- JavaScript变量、作用域和内存问题(二)——垃圾收集器