codeforces 706A Beru-taxi
来源:互联网 发布:抓取网页数据工具 编辑:程序博客网 时间:2024/05/18 07:30
点击打开链接
Vasiliy lives at point (a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as possible. New app suggested n available Beru-taxi nearby. The i-th taxi is located at point (xi, yi) and moves with a speed vi.
Consider that each of n drivers will move directly to Vasiliy and with a maximum possible speed. Compute the minimum time when Vasiliy will get in any of Beru-taxi cars.
The first line of the input contains two integers a and b ( - 100 ≤ a, b ≤ 100) — coordinates of Vasiliy's home.
The second line contains a single integer n (1 ≤ n ≤ 1000) — the number of available Beru-taxi cars nearby.
The i-th of the following n lines contains three integers xi, yi and vi ( - 100 ≤ xi, yi ≤ 100, 1 ≤ vi ≤ 100) — the coordinates of the i-th car and its speed.
It's allowed that several cars are located at the same point. Also, cars may be located at exactly the same point where Vasiliy lives.
Print a single real value — the minimum time Vasiliy needs to get in any of the Beru-taxi cars. You answer will be considered correct if its absolute or relative error does not exceed 10 - 6.
Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
0 022 0 10 2 2
1.00000000000000000000
1 333 3 2-2 3 6-2 7 10
0.50000000000000000000
In the first sample, first taxi will get to Vasiliy in time 2, and second will do this in time 1, therefore 1 is the answer.
In the second sample, cars 2 and 3 will arrive simultaneously.
暴力
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<cstdlib>using namespace std;typedef long long ll;int main(){ double a,b; int n; double x,y,v; cin>>a>>b; cin>>n; cin>>x>>y>>v; double w=(a-x)*(a-x)+(b-y)*(b-y); double mi=sqrt(w)/v; for(int i=1; i<n; i++) { cin>>x>>y>>v; w=(a-x)*(a-x)+(b-y)*(b-y); mi=min(mi,sqrt(w)/v); } printf("%.20f\n",mi); return 0;}
- CodeForces 706A Beru-taxi
- 【codeforces 706A Beru-taxi】
- CodeForces-706A.Beru-taxi
- codeforces 706A Beru-taxi
- codeforces 706A A. Beru-taxi
- 【模拟】Codeforces 706A Beru-taxi
- CodeForces 706A Beru-taxi 【水题】
- codeforces-367#A. Beru-taxi
- A. Beru-taxi
- 【Codeforces Round 367 (Div 2) A】【水题】Beru-taxi
- Codeforces Round #367 (Div. 2) A. Beru-taxi
- Codeforces Round #367 (Div. 2) A. Beru-taxi(很水)
- codeforces706A之Beru-taxi
- CodeForces 158B taxi
- 【codeforces】B. Taxi
- CodeForces 158B Taxi
- codeforces 158B Taxi
- Codeforces B. Taxi 算法题解
- HTTP 500 Internal Server Error
- npm update
- CentOS 环境搭建并测试Node.js服务器开发环境
- Python 构造二叉搜索树
- 林纳斯·托瓦兹(Linus Torvalds)为什么被称作大神?
- codeforces 706A Beru-taxi
- 关于预答辩研究生汇报内容及方式的几点要求
- <剑指offer>javascript解法(1-65)
- PAT (Basic Level) Practise (中文) 1046. 划拳(15)
- Lua_ Lua结合BundleManager实现网络热更新_023
- C语言里的符号重载《C专家编程》
- 框架常见面试题
- 前端框架:Angular React 和 Vue的比较
- TensorFlow学习笔记(二)把数字标签转化成onehot标签