【模拟】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 ...
随机推荐
- Toast的使用具体解释
Android中提供一种简单的Toast消息提示框机制,能够在用户点击了某些button后,提示用户一些信息,提示的信息不能被用户点击,Toast的提示信息依据用户设置的显示时间后自己主动消失.Toa ...
- 代码讲解Android Scroller、VelocityTracker
在编写自定义滑动控件时常常会用到Android触摸机制和Scroller及VelocityTracker.Android Touch系统简介(二):实例详解onInterceptTouchEvent与 ...
- SAP OTR 字段维护 更改SAP的字段翻译
维护系统文本字段:SOTR_EDIT TC:SE63 在SAP用户选择屏幕中,用鼠标选定一个栏位后按F1键,能够看到SAP对其详细解释,通常这样的解释文本分为两部分,一部分为标题, ...
- Linux开发工具之gdb(下)
三.gdb调试(下) 01.查看运行时数据 print - 查看变量值 ptype - 查看类型 print array - 查看数组 print *array@len - 查看动态内存 print ...
- JSON 解析(门店)
package com.j1.mai.action; import java.io.BufferedReader; import java.io.IOException; import java.io ...
- ACCSESS数据库导入到SQL SEVERES2005
首先打开Access数据库然后选择一张表,右击选择要导入数据库的类型(此处已sql2005为例) 然后选择新建 点击下一步 选择导入数据库类型(sql) 输入一个名称,在前面能用到(此处建的是250) ...
- 获取Html中所有img的src
/// <summary> /// 获取所有Img中的Src /// </summary> /// <param name="htmlText"> ...
- js的异步的问题的再次理解
*js是实实在在的单线程语言,在一小个时刻,在(js的执行对列)只有一个执行,一个没有完,另一个必须等待,什么都不做,只有抖着腿的等; *本来语言本身是同步的,之所以是异步执行,是因为在浏览器环境中, ...
- php 写model层
<?php /** * @author Administrator * */ class User { private $id; private $admin; private $paw; pr ...
- Wpf控件ListBox使用实例2
2.Xaml绑定选择结果 <StackPanel Orientation="Vertical"> <TextBlock Margin="10,10,10 ...