【模拟】Codeforces 706A Beru-taxi
题目链接:
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()
{
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
// freopen("2.txt","w",stdout);
#endif
int i,j,x,y,v;
// for(scanf("%d",&cas);cas;cas--)
// for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
// while(~scanf("%s",s))
while(~scanf("%d%d",&sx,&sy))
{
t=MAX;
scanf("%d",&n);
for(i=;i<=n;i++)
{
scanf("%d%d%d",&x,&y,&v);
s=(double)sqrt(sqr(x-sx)+sqr(y-sy))/v;
t=min(t,s);
}
printf("%lf\n",t);
}
return ;
}
/*
// //
*/
【模拟】Codeforces 706A Beru-taxi的更多相关文章
- Codeforces 158 B. Taxi[贪心/模拟/一辆车最多可以坐4人同一个群的小朋友必须坐同一辆车问最少需要多少辆车]
http://codeforces.com/problemset/problem/158/B B. Taxi time limit per test 3 seconds memory limit pe ...
- CodeForces 158 B. Taxi(模拟)
[题目链接]click here~~ [题目大意]n组团体去包车,每组团体的人数<=4,一辆车最多容纳4人,求所求车的数目最小 [解题思路]:思路见代码~~ // C #ifndef _GLIB ...
- 贪心+模拟 Codeforces Round #288 (Div. 2) C. Anya and Ghosts
题目传送门 /* 贪心 + 模拟:首先,如果蜡烛的燃烧时间小于最少需要点燃的蜡烛数一定是-1(蜡烛是1秒点一支), num[g[i]]记录每个鬼访问时已点燃的蜡烛数,若不够,tmp为还需要的蜡烛数, ...
- 模拟 Codeforces Round #203 (Div. 2) C. Bombs
题目地址:http://codeforces.com/problemset/problem/350/C /* 题意:机器人上下左右走路,把其他的机器人都干掉要几步,好吧我其实没读懂题目, 看着样例猜出 ...
- 模拟 Codeforces Round #249 (Div. 2) C. Cardiogram
题目地址:http://codeforces.com/contest/435/problem/C /* 题意:给一组公式,一组数据,计算得到一系列的坐标点,画出折线图:) 模拟题:蛮恶心的,不过也简单 ...
- 模拟 Codeforces Round #297 (Div. 2) A. Vitaliy and Pie
题目传送门 /* 模拟:这就是一道模拟水题,看到标签是贪心,还以为错了呢 题目倒是很长:) */ #include <cstdio> #include <algorithm> ...
- queue+模拟 Codeforces Round #304 (Div. 2) C. Soldier and Cards
题目传送门 /* 题意:两堆牌,每次拿出上面的牌做比较,大的一方收走两张牌,直到一方没有牌 queue容器:模拟上述过程,当次数达到最大值时判断为-1 */ #include <cstdio&g ...
- 模拟 Codeforces Round #288 (Div. 2) A. Pasha and Pixels
题目传送门 /* 模拟水题:给定n*m的空白方格,k次涂色,将(x,y)处的涂成黑色,判断第几次能形成2*2的黑色方格,若不能,输出0 很挫的判断四个方向是否OK */ #include <cs ...
- Codeforces 158B:Taxi
B. Taxi time limit per test 3 seconds memory limit per test 256 megabytes input standard input outpu ...
随机推荐
- ThinkPHP pdo连接Oracle的配置写法,提示报错
'DB_TYPE' => 'pdo', // 数据库类型 'DB_USER' => 'user101', // username 'DB_PWD' => 'zb~!@#$%', // ...
- ld: 18 duplicate symbols for architecture i386 .linker command failed with exit code 1 (use -v to see invocation)_
昨天被linker这个错误卡了一个小时!!!各种办法都试了 是导入第三方的问题 .. 网上说 要把所有的.m文件导入 但是我下载的微博SDK根本不关事..后来 大概知道是导入了多个相同的文件... ...
- C/C++ Linux 程序员必须了解的 10 个工具
1. 基本命令http://mally.stanford.edu/~sr/computing/basic-unix.htmlhttp://pangea.stanford.edu/computing/u ...
- 对于android拦截短信的一些疑问
最近折腾android4.4短信拦截的问题,要求在app上收到短信的时候弹出提示,并显示的功能. 然后找到了使用broadcastreceiver和contentprovider两种方法,那么问题来了 ...
- java中-静态代码块、构造代码块、构造方法的联系
例如该题: 1 class Fu{ static { System.out.println("这是父类静态代码块"); } { System.out.println("这 ...
- ansible小结
一.Ansible的安装 1.yum源安装 以centos为例,默认在源里没有ansible,不过在fedora epel源里有ansible,配置完epel 源后,可以直接通过yum 进行安装.这里 ...
- python-列表、字典、元组的员工信息处理接口(第二篇(五):基于列表、字典和元组的员工信息处理接口)
Python之旅]第二篇(五):基于列表.字典和元组的员工信息处理接口 python 列表 字典 元组 员工信息处理接口 摘要: 1.基本需求 编写一个查询员工信息表的程序,实现如下功能: ( ...
- 【开源java游戏框架libgdx专题】-06-使用libgdx自带的日志方法
Application 接口提供了简单的日志记录,并且提供了颗粒度的控制. Gdx.app.log("MyTag", "my informative message&qu ...
- 5JS树形结构菜单和jQuery版
第一版JS版HTML: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> & ...
- javascript 动态控制复选框的选择和取消
这里就需要引入一个jquery-1.4.2.js 就行了,因为用到了里面的选择器 <html> <head> <script type="text/javasc ...