[none]CodeForces 534B
来源:互联网 发布:淘宝网购物精品羊毛衫 编辑:程序博客网 时间:2024/06/09 15:13
题意:
给出起点和终点的速度还有时间,问在速度上下拨动不能超过d的情况下,求出最大的路程。
分析:
其实怎么做还是得枚举峰值,那么峰值改怎么求呢?贪心的一直+d,后面保证还能减回v2,那么就每次取两条向上和向下的线的最小值就可以了。。
#include <cstdio>#include <cstring>#include <cmath>#include <iostream>#include <vector>#include <map>#include <set>#include <queue>#include <algorithm>#define read freopen("q.in","r",stdin)#define LL long long#define maxn 1000005using namespace std;int main(){ int t,d,v1,v2,res=0; while(~scanf("%d%d%d%d",&v1,&v2,&t,&d)) { res=0; res+=(v1+v2); for(int i=2;i<t;i++) res+=min(v1+(i-1)*d,(t-i)*d+v2); cout<<res<<endl; }}
0 0
- [none]CodeForces 534B
- CodeForces 534B
- codeforces 534B B. Covered Path(dp)
- Codeforces 534B Covered Path
- codeforces-534B-Covered Path
- CodeForces 534B Covered Path
- CodeForces 534B Covered Path
- codeforces B
- codeforces B
- codeforces B
- codeforces B
- Codeforces 534B Covered Path(贪心)
- CodeForces 534B Covered Path 【贪心】
- codeforces 534B Covered Path-思维
- None
- None
- None
- None
- TCP四次挥手中的2MSL是什么?
- 黑马程序员——java多线程学习笔记(纯干货附送个人学习感悟)
- HAVING字句的使用
- 3、类和对象
- 【Android开发】获取已安装应用的安装文件(apk文件)
- [none]CodeForces 534B
- Android开发过程遇到的问题
- 成长,没你想得那么迫切——雅虎《另一种活法》
- 制作Linux根文件系统关于链接库的问题
- 实型变量
- 猫猫学iOS(五十二)多线程网络之GCD下单例设计模式
- pypose机械臂简单控制
- linux下对第三方程序的代码执行效率分析
- opencms默认后缀名修改