我就做了前两题,第一题第一次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) 没什么题解就留坑待填的更多相关文章

  1. Codeforces Round #612 (Div. 2) 前四题题解

    这场比赛的出题人挺有意思,全部magic成了青色. 还有题目中的图片特别有趣. 晚上没打,开virtual contest打的,就会前三道,我太菜了. 最后看着题解补了第四道. 比赛传送门 A. An ...

  2. Codeforces Round #198 (Div. 2)A,B题解

    Codeforces Round #198 (Div. 2) 昨天看到奋斗群的群赛,好奇的去做了一下, 大概花了3个小时Ak,我大概可以退役了吧 那下面来稍微总结一下 A. The Wall Iahu ...

  3. Codeforces Round #672 (Div. 2) A - C1题解

    [Codeforces Round #672 (Div. 2) A - C1 ] 题目链接# A. Cubes Sorting 思路: " If Wheatley needs more th ...

  4. Codeforces Round #364 (Div.2) C:They Are Everywhere(双指针/尺取法)

    题目链接: http://codeforces.com/contest/701/problem/C 题意: 给出一个长度为n的字符串,要我们找出最小的子字符串包含所有的不同字符. 分析: 1.尺取法, ...

  5. Codeforces Round #614 (Div. 2) A-E简要题解

    链接:https://codeforces.com/contest/1293 A. ConneR and the A.R.C. Markland-N 题意:略 思路:上下枚举1000次扫一遍,比较一下 ...

  6. Codeforces Round #610 (Div. 2) A-E简要题解

    contest链接: https://codeforces.com/contest/1282 A. Temporarily unavailable 题意: 给一个区间L,R通有网络,有个点x,在x+r ...

  7. Codeforces Round #611 (Div. 3) A-F简要题解

    contest链接:https://codeforces.com/contest/1283 A. Minutes Before the New Year 题意:给一个当前时间,输出离第二天差多少分钟 ...

  8. Codeforces Round #364 (Div. 2)

    这场是午夜场,发现学长们都睡了,改主意不打了,第二天起来打的virtual contest. A题 http://codeforces.com/problemset/problem/701/A 巨水无 ...

  9. Codeforces Round #364 (Div. 2) Cells Not Under Attack

    Cells Not Under Attack 题意: 给出n*n的地图,有给你m个坐标,是棋子,一个棋子可以把一行一列都攻击到,在根据下面的图,就可以看出让你求阴影(即没有被攻击)的方块个数 题解: ...

随机推荐

  1. Codeforces 536C Tavas and Pashmaks(凸壳)

    题目链接 Tavas and Pashmaks 题目大意:n个人比赛,游泳和赛跑,游泳距离S,赛跑R.每个人对应两个速度(陆地和水上的),如果存在S,R,使得第i个人胜利,那么输出i 题目要求输出所有 ...

  2. Light oj 1085 - All Possible Increasing Subsequences (简单dp + 离散化 + BIT)

    题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1085 题意: 问你有多少个上升子序列. 思路: dp[i]表示以第i个数结尾的 ...

  3. cef 下载地址

    最新的CEF3源代码在:http://cefbuilds.com/CEF3的论坛:http://www.magpcss.org/ceforum/viewforum.php?f=5CEF3 C++开发环 ...

  4. bubble chat listview

    最近在iOS中用到bubble chat listview,找了个比较有名气的lib(MessagesTableViewController)=>https://github.com/jesse ...

  5. Android 测试自定义纯数字软键盘

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools= ...

  6. iOS- Exception Type: 00000020:什么是看门狗机制(转)

    1.前言    前几天我们项目闪退之后遇到的一个Crash,之后逛了许多论坛,博客都没有找到满意的回复  在自己做了深入的研究之后,对iOS的看门狗机制有了一个基本的了解  而有很多奇怪的Crash可 ...

  7. Windows Server 2008R2 设置SMTP邮件转发服务

    最近因业务需求在Windows Server 2008R2server上设置SMTP转发服务,主要是在业务审批过程中邮件通知相关人员审批情况, 1.在server上加入服务 2.打开服务 3.新建一个 ...

  8. xml实现AOP

    1.使用<aop:config></aop:config> 2.首先我们需要配置<aop:aspect></aop:aspect>,就是配置切面 2.1 ...

  9. stringByAppendingPathComponent和stringByAppendingString 的区别

    stringByAppendingPathComponent和stringByAppendingString 的区别   stringByAppendingPathComponent NSString ...

  10. vuex 介绍

    vuex是为vue.js开发的状态管理模式,负责vue的状态管理,状态管理是干啥的呢,举个栗子,比如一个酒店,哪间屋子入住了客人,哪间屋子客人退房了,客人退房后,房间有没有清扫过,这些都需要去记录,以 ...