Codeforces Round #364 (Div. 1)(vp) 没什么题解就留坑待填
我就做了前两题,第一题第一次vp就把我搞自闭跑路了,第二题第二次又把我搞自闭了
A. As Fast As Possible
细节题
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
using namespace std; int n,k; double L,v1,v2;
bool check(double T)
{
int u=; double p=,b=,t=;
u+=k;
double ct=(L-v1*T)/(v2-v1);//需要公交带多久才能到结束位置
if(ct<)return true;
t+=ct;
if(t>T)return false;
p+=v1*ct;
b+=v2*ct; while(u<n)
{
ct=(b-p)/(v1+v2);//相遇要多久
t+=ct;
if(t>T)return false;
p+=v1*ct;
b=p; u+=k;
ct=(L-p-v1*(T-t))/(v2-v1);
if(ct<)return true;
t+=ct;
if(t>T)return false;
p+=v1*ct;
b+=v2*ct;
}
return true;
}
int main()
{
scanf("%d%lf%lf%lf%d",&n,&L,&v1,&v2,&k);
long double l=,r=L;
while(r-l>1e-)
{
long double mid=(l+r)/2.0;
if(check(mid))r=mid;
else l=mid;
}
printf("%.8Lf\n",l); return ;
}
A. As Fast As Possible
B. Connecting Universities
这个贪心题做着做着就懵逼了。。。
有三个做法,其一是按dfs序排序。第i个和第i+k个直接匹配,稍微画画图就是对的
第二是考虑每一条边,这条边最多被经过左右两端关键点数的min
第三是一个节点如果其最多关键点的孩子子树不超过k,那么所有的边都可以两两配对,找到这个点,答案就是所有关键到这个点的和
懒得复制代码了,都很好写
Codeforces Round #364 (Div. 1)(vp) 没什么题解就留坑待填的更多相关文章
- Codeforces Round #612 (Div. 2) 前四题题解
这场比赛的出题人挺有意思,全部magic成了青色. 还有题目中的图片特别有趣. 晚上没打,开virtual contest打的,就会前三道,我太菜了. 最后看着题解补了第四道. 比赛传送门 A. An ...
- Codeforces Round #198 (Div. 2)A,B题解
Codeforces Round #198 (Div. 2) 昨天看到奋斗群的群赛,好奇的去做了一下, 大概花了3个小时Ak,我大概可以退役了吧 那下面来稍微总结一下 A. The Wall Iahu ...
- Codeforces Round #672 (Div. 2) A - C1题解
[Codeforces Round #672 (Div. 2) A - C1 ] 题目链接# A. Cubes Sorting 思路: " If Wheatley needs more th ...
- Codeforces Round #364 (Div.2) C:They Are Everywhere(双指针/尺取法)
题目链接: http://codeforces.com/contest/701/problem/C 题意: 给出一个长度为n的字符串,要我们找出最小的子字符串包含所有的不同字符. 分析: 1.尺取法, ...
- Codeforces Round #614 (Div. 2) A-E简要题解
链接:https://codeforces.com/contest/1293 A. ConneR and the A.R.C. Markland-N 题意:略 思路:上下枚举1000次扫一遍,比较一下 ...
- Codeforces Round #610 (Div. 2) A-E简要题解
contest链接: https://codeforces.com/contest/1282 A. Temporarily unavailable 题意: 给一个区间L,R通有网络,有个点x,在x+r ...
- Codeforces Round #611 (Div. 3) A-F简要题解
contest链接:https://codeforces.com/contest/1283 A. Minutes Before the New Year 题意:给一个当前时间,输出离第二天差多少分钟 ...
- Codeforces Round #364 (Div. 2)
这场是午夜场,发现学长们都睡了,改主意不打了,第二天起来打的virtual contest. A题 http://codeforces.com/problemset/problem/701/A 巨水无 ...
- Codeforces Round #364 (Div. 2) Cells Not Under Attack
Cells Not Under Attack 题意: 给出n*n的地图,有给你m个坐标,是棋子,一个棋子可以把一行一列都攻击到,在根据下面的图,就可以看出让你求阴影(即没有被攻击)的方块个数 题解: ...
随机推荐
- windows下git使用
一. 下载及安装 下载 git2.14.1 64bit https://git-for-windows.github.io/(官网下载不动) http://download.csdn.net/dow ...
- [原创][Verilog]个人.v文件书写规范
1> 文件名命名,小些单词为主且从命名中可以大致读出其功能,例如:fpga_power.v,can_ctrl.v等命名. 2> 顶层top文件的输入输出IO信号使用大些表示,且加上”i/o ...
- ubuntu和raspberry下调试python_spi备忘
Ubuntu12.04 自安装python3.3中头文件Python.h路径:usr/local/python3.3/include/python3.3m Ubuntu12.04 自带的Python2 ...
- javascript 函数初探 (五)--- 几种类型的函数
即时函数: 目前我们已经讨论了匿名函数在回调时的应用.接下来,我们来看看匿名函数的另一种应用实例 --- javascript即时函数: 比如: ( function(){ alert('her'); ...
- 四个很好的开源app项目
Open Source and the iOS App Store Today, we are open-sourcing 4 iOS apps: ThatInbox, an email client ...
- 【jQuery】input textarea 文本变化的动态监听
实时监听Input textarea文本变化的监听事件:[但不包含通过js动态添加改变的文本事件] HTML: <textarea style="display: none" ...
- 【bootstrap】Bootstrap Notify的使用步骤
Bootstrap Notify说明文档:http://bootstrap-notify.remabledesigns.com/ Bootstrap Notify的GitHub地址:https://g ...
- 【转载】React入门实例教程-读书笔记
参考了这篇文章: http://www.ruanyifeng.com/blog/2015/03/react.html 其中github 安装配置见上一篇文章(link) 一.HTML 模板 使用 Re ...
- ZooKeeper 授权验证
ZooKeeper 授权验证 学习了:https://blog.csdn.net/liuyuehu/article/details/52121755 zookeeper可以进行认证授权:
- [学习笔记]Java异常机制
概述 异常 程序在执行时出现的不正常情况,是对问题的描写叙述.将问题进行对象的封装. Java中的异常,就是对不正常情况进行描写叙述后的对象体现. 异常体系 Throwable |--Erro ...