-
Notifications
You must be signed in to change notification settings - Fork 0
/
ABeruTaxi.cpp
100 lines (82 loc) · 2.62 KB
/
ABeruTaxi.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//http://codeforces.com/contest/706
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
#define printv(data) for(auto& e:data) cout<<e<<","; cout<<endl;
#define sortv(data) std::sort(data.begin(),data.end());
#define rsortv(data) std::sort(data.rbegin(),data.rend());
#define fori(start,end) for(size_t i{start};i<=end;i++)
#define forj(start,end) for(size_t j{start};j<=end;j++)
#define rofi(start,end) for(size_t i{start};i>end;i--)
#define foralli(data) fori(0,data.size())
using ll = long long;
using ld = long double;
using pll = std::pair<ll,ll>;
using vpll = std::vector<pll>;
using vll = std::vector<ll>;
constexpr ll BIGLL{ std::numeric_limits<ll>::max() };
constexpr ld BIGLD{ std::numeric_limits<ld>::max() };
constexpr ll LL10{ 10000000000 + 1 };
constexpr ld pi = 3.141592653589793238462643383279502884;
template<typename t,typename t2>
auto min(t&& a,t2&& b) -> decltype(a+b){ return a < b ? a : b; }
template<typename t,typename t2>
auto max(t&& a,t2&& b) -> decltype(a+b){ return a > b ? a : b; }
template<typename N>
N multimax_impl(N cur,N last)
{ return max(cur,last); }
template<typename N,typename...VALS>
N multimax_impl(N cur,N n,VALS...vals)
{ return multimax_impl(max(cur,n),vals...); }
template<typename N,typename...VALS>
N multimax(N f,VALS...values)
{ return multimax_impl(std::numeric_limits<N>::min(),f,values...); }
template<typename T>
T pow(T n,T e){
T r{1};
while(e--)
r*=n;
return r;
}
ll prime_factors(ll n,std::vector<ll>& data){
while(n%2==0){data.emplace_back(2);n/=2;}
for(ll i{3};i<=sqrt(n);i+=2){while(n%i==0){data.emplace_back(i);n/=i;}}
if(n>2) data.emplace_back(n);
return data.size();
}
#define get(var_name) ll var_name{0}; cin >> var_name;
#define gets(var_name) std::string var_name; cin >> var_name;
#define readv(start,end,vec_name) std::vector<ll> vec_name(end); for(size_t i{start};i<end;i++) cin>>vec_name[i];
#define getpll(llp) std::cin>>llp.first>>llp.second;
//specific for codeforces
#ifndef ONLINE_JUDGE
#define Log(...) fprintf (stdout, __VA_ARGS__);
#define LogN(num) fprintf (stdout, "@: %l64d\n", num);
#define LogS(str) fpringf (stdout, "@: %s\n", str.c_str());
#else
#define Log(...)
#define LogN(num)
#define LogS(str)
#endif
int main()
{
ios_base::sync_with_stdio(false);
get(x);
get(y);
ld dmin = BIGLL;
get(n);
fori(1,n){
ll xx,yy,s;
cin >> xx >> yy >> s;
ld d = std::sqrt(pow(xx-x,2) + pow(yy-y,2));
d /= s;
if(d<dmin){
dmin = d;
}
}
std::cout.precision(16);
std::cout<<dmin<<std::endl;
return 0;
}