zoukankan      html  css  js  c++  java
  • 【模拟】Codeforces 706A Beru-taxi

    题目链接:

      http://codeforces.com/problemset/problem/706/A

    题目大意

      家的坐标在sx,sy,有n辆车,每辆车坐标xi,yi,速度vi,问最快的一辆车什么时候到家。

    题目思路:

      【模拟】

      签到题。

     1 //
     2 //by coolxxx
     3 //
     4 #include<iostream>
     5 #include<algorithm>
     6 #include<string>
     7 #include<iomanip>
     8 #include<memory.h>
     9 #include<time.h>
    10 #include<stdio.h>
    11 #include<stdlib.h>
    12 #include<string.h>
    13 //#include<stdbool.h>
    14 #include<math.h>
    15 #define min(a,b) ((a)<(b)?(a):(b))
    16 #define max(a,b) ((a)>(b)?(a):(b))
    17 #define abs(a) ((a)>0?(a):(-(a)))
    18 #define lowbit(a) (a&(-a))
    19 #define sqr(a) ((a)*(a))
    20 #define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
    21 #define eps (1e-8)
    22 #define J 10000000
    23 #define MAX 0x7f7f7f7f
    24 #define PI 3.1415926535897
    25 #define N 4
    26 using namespace std;
    27 typedef long long LL;
    28 int cas,cass;
    29 int n,m,lll,ans;
    30 int sx,sy;
    31 double t,s;
    32 int main()
    33 {
    34     #ifndef ONLINE_JUDGE
    35 //    freopen("1.txt","r",stdin);
    36 //    freopen("2.txt","w",stdout);
    37     #endif
    38     int i,j,x,y,v;
    39 //    for(scanf("%d",&cas);cas;cas--)
    40 //    for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
    41 //    while(~scanf("%s",s))
    42     while(~scanf("%d%d",&sx,&sy))
    43     {
    44         t=MAX;
    45         scanf("%d",&n);
    46         for(i=1;i<=n;i++)
    47         {
    48             scanf("%d%d%d",&x,&y,&v);
    49             s=(double)sqrt(sqr(x-sx)+sqr(y-sy))/v;
    50             t=min(t,s);
    51         }
    52         printf("%lf
    ",t);
    53     }
    54     return 0;
    55 }
    56 /*
    57 //
    58 
    59 //
    60 */
    View Code
  • 相关阅读:
    IIS配置ThinkPHP重写
    Redis安装
    ubuntu学习笔记
    PHP连接MySQL数据库SELinux中一些setsebool的用法
    centos+frp
    centos7.6安装nginx
    在CentOS 7-8上安装PHP 8.0
    centos7安装.net5.0(core)
    阿里云服务器配置清单
    阿里云服务器centos7.6安装mysql8.0.23
  • 原文地址:https://www.cnblogs.com/Coolxxx/p/5768955.html
Copyright © 2011-2022 走看看