codeforces 703C
来源:互联网 发布:linux运行级别介绍 编辑:程序博客网 时间:2024/05/21 09:14
题意:有一辆汽车从马路上穿过(不会让人的,可以看成凸多边形),一个人从马路这头最快要多久可以走到对面。速度不能超过一定值,不能被撞。
题解:贪心。过马路无非两种情况,(1)在凸多边形的每个点到达马路上之前通过这个点(全部可以的话就急速通过)。每个点走过之后再急速穿过。
#include<bits/stdc++.h>using namespace std;typedef pair<double,double> pdd;#define X first#define Y secondconst double eps = 1e-8;int main(){ios_base::sync_with_stdio(false);int n;double w,v,u;while(cin>>n>>w>>v>>u){vector<pdd> d(n);for(int i=0;i<n;i++){cin>>d[i].X>>d[i].Y;}bool ok = true;for(int i=0;i<n;i++){if(d[i].Y/u-eps>d[i].X/v){ok = false;break;}}if(ok){cout<<setprecision(6)<<fixed<<w/u<<endl;continue;}double ret = w/u;for(int i=0;i<n;i++){ret = max(d[i].X/v+(w-d[i].Y)/u,ret);}cout<<setprecision(6)<<fixed<<ret<<endl;}return 0;}
0 0
- codeforces 703C
- codeforces 703C
- codeforces 703c(简单几何)
- codeforces 703C Chris and Road
- Codeforces 703C 思维or计算几何
- CodeForces - 703C Chris and Road
- CodeForces 703C Chris and Road
- codeforces 703 C. Chris and Road
- 【23.15%】【codeforces 703C】Chris and Road
- Codeforces-340-C(c++)
- Codeforces-507-C(c++)
- CodeForces 731C C
- CodeForces-612C C
- CODEFORCES 265C CODEFORCES, 265C
- codeforces #78 div2 C
- Codeforces 117C Cycle
- CodeForces 209C
- CodeForces 156C Cipher
- itoa的实现
- ListView中嵌套ListView
- scrollView ——自动轮播并且设置图片底部小圆点
- Android ANR问题
- Android中 "WebView"的使用
- codeforces 703C
- 拦截器在struts2中的应用
- 【60】把二叉树打印成多行
- 侧滑菜单HorizontalScrollView,类中如何使用intent跳转
- OkHttp
- ZooKeeper的原生API
- nginx负载均衡配置
- jzoj 2549. 【NOIP2011模拟9.4】家庭作业
- Uva 725 Division(暴力)