cf702D Road to Post Office】的更多相关文章

D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals to d ki…
Codeforce 702 D. Road to Post Office 解析(思維) 今天我們來看看CF702D 題目連結 題目 略,請直接看原題. 前言 原本想說會不會也是要列式子解或者二分搜,沒想到意外的是思考非常簡單的一題 @copyright petjelinux 版權所有 觀看更多正版原始文章請至petjelinux的blog 想法 如果坐車\(k\)公里加上修理比走路\(k\)公里還要慢,那麼我們只需要先坐車\(k\)公里,然後不要修,直接走路走完全程. 如果坐車\(k\)公里加上…
Road to Post Office 题意: 一个人要从0走到d,可以坐车走k米,之后车就会坏,你可以修或不修,修要花t时间,坐车单位距离花费a时间,走路单位距离花费b时间,问到d的最短时间. 题解: 首先要分成k段,k段的总长是ovmod,每一段可以选择修车坐车或选择走路,(只有第一段的时候不用修车),最后在加上剩下的那些路的时间,剩下的是mod,(可以选择修车坐车或选择走路)最后min答案就好了.但其中还有一种情况要注意,就是前ovmod也可以选择坐车之后不修走着,所以这种要特殊处理下.…
D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals to d ki…
D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals to d ki…
D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals to d ki…
题目链接: D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals t…
题目描述 Vasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals to ddkilometers. Vasiliy's car is not new — it breaks after driven every kk kilometers and Vasiliy needs tt seconds to repair it. Afte…
http://codeforces.com/contest/702 题意:人到邮局去,距离d,汽车在出故障前能跑k,汽车1公里耗时a,人每公里耗时b,修理汽车时间t,问到达终点最短时间 思路:计算车和人的平均速度,谁快用谁,最后特判<=k的距离 // #pragma comment(linker, "/STACK:102c000000,102c000000") #include <iostream> #include <cstdio> #include &…
答案的来源不外乎于3种情况: 纯粹走路,用时记为${t_1}$:纯粹乘车,用时记为${t_2}$:乘车一定距离,然后走路,用时记为${t_3}$. 但是${t_1}$显然不可能成为最优解. 前两个时间都挺好算的,${t_3}$算的时候要讨论一下. 如果是$a*k+t>=b*k$,那么也就是说第一个$k$的距离开车,然后开始走路. 如果是$a*k+t<b*k$,那么可以尝试着最后不到$k$的距离走路,前面的都开车. 直接得出数学公式有点难度,因为最优解不会逃出${t_1}$,${t_2}$,${…