题目链接:
http://codeforces.com/problemset/problem/706/A
题目大意:
家的坐标在sx,sy,有n辆车,每辆车坐标xi,yi,速度vi,问最快的一辆车什么时候到家。
题目思路:
【模拟】
签到题。
//
//by coolxxx
//
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<memory.h>
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//#include<stdbool.h>
#include<math.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(a) ((a)>0?(a):(-(a)))
#define lowbit(a) (a&(-a))
#define sqr(a) ((a)*(a))
#define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
#define eps (1e-8)
#define J 10000000
#define MAX 0x7f7f7f7f
#define PI 3.1415926535897
#define N 4
using namespace std;
typedef long long LL;
int cas,cass;
int n,m,lll,ans;
int sx,sy;
double t,s;
int main()
{
<span style="white-space:pre"> </span>#ifndef ONLINE_JUDGE
//<span style="white-space:pre"> </span>freopen("1.txt","r",stdin);
//<span style="white-space:pre"> </span>freopen("2.txt","w",stdout);
<span style="white-space:pre"> </span>#endif
<span style="white-space:pre"> </span>int i,j,x,y,v;
//<span style="white-space:pre"> </span>for(scanf("%d",&cas);cas;cas--)
//<span style="white-space:pre"> </span>for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
//<span style="white-space:pre"> </span>while(~scanf("%s",s))
<span style="white-space:pre"> </span>while(~scanf("%d%d",&sx,&sy))
<span style="white-space:pre"> </span>{
<span style="white-space:pre"> </span>t=MAX;
<span style="white-space:pre"> </span>scanf("%d",&n);
<span style="white-space:pre"> </span>for(i=1;i<=n;i++)
<span style="white-space:pre"> </span>{
<span style="white-space:pre"> </span>scanf("%d%d%d",&x,&y,&v);
<span style="white-space:pre"> </span>s=(double)sqrt(sqr(x-sx)+sqr(y-sy))/v;
<span style="white-space:pre"> </span>t=min(t,s);
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span>printf("%lf\n",t);
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span>return 0;
}
/*
//
//
*/