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个坐标,是棋子,一个棋子可以把一行一列都攻击到,在根据下面的图,就可以看出让你求阴影(即没有被攻击)的方块个数 题解: ...
随机推荐
- 1007 Maximum Subsequence Sum
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to ...
- MySQL 服务无法启动-问题处理
症状:前一天在MySQL中删除了几个不用的数据库后登陆MySQL出现以下错误: mysql -u root -p passwd ERROR 2002 (HY000): Can't connec ...
- 【spring boot】5.spring boot 创建web项目并使用jsp作前台页面
贼烦的是,使用spring boot 创建web项目,然后我再idea下创建的,but 仅仅启动spring boot的启动类,就算整个项目都是好着的,就算是能够进入controller中,也不能成功 ...
- 【spring boot】13.在spring boot下使用多线程
使用场景: 方法处理到某一步,需要将信息交给另一个线程去处理!! =================================================================== ...
- sql的一些知识_数据分组
group by--------按**分组查询 SELECT rank, MIN(weight)as min_weight FROM userinfo GROUP BY rank 对分组的值进行过滤需 ...
- JavaScript-4.7-friendly_table---ShinePans
<html> <head> <meta http-equiv="content-type" content="text/html;chars ...
- leetcode 题解 || Remove Nth Node From End of List 问题
problem: Given a linked list, remove the nth node from the end of list and return its head. For exam ...
- XSS过滤
XSS过滤封装用法 封装到app01/form.py文件中进行验证 from django.forms import Form,widgets,fields class ArticleForm(For ...
- 为什么应使用 Node.js
为什么应使用 Node.js JavaScript 高涨的人气带来了很多变化,以至于如今使用其进行网络开发的形式也变得截然不同了.就如同在浏览器中一样,现在我们也可以在服务器上运行 JavaScrip ...
- Android通过JNI实现与C语言的串口通讯操作蓝牙硬件模块
一直想写一份技术文档,但因为自感能力有限而无从下笔,近期做了个关于Android平台下实现与C语言的通讯来操作蓝牙模块的项目,中间碰到了很多问题,也在网上查了很多资料,在完毕主要功能后.也有一些人在网 ...