[BZOJ4658]rescue
来源:互联网 发布:安卓 网络加速器 编辑:程序博客网 时间:2024/05/16 08:58
傻傻的NBC好久没更博啦.
似乎荒废了.
要这博客何用..
好吧好吧切入正题
方便起见令
最终答案是
于是得到了
#include <cstdio>long long f[100002];int K, M, D, A, N, T[100002], B[100002];inline long long max(long long x, long long y){ return x > y ? x : y;}int main(){ scanf("%d%d%d%d%d", &K, &M, &D, &A, &N); T[0] = K, T[N + 1] = M; for (int i = 1; i <= N; i++) scanf("%d%d", T + i, B + i); for (int i = 1; i <= N + 1; i++) { f[i] = -1ll << 62; for (int j = 0; j < i; j++) f[i] = max(f[i], f[j] - (T[i] - T[j] + D - 1) / D * A); f[i] += B[i]; } printf("%lld\n", f[N + 1]); return 0;}
现在睁大你可爱的小眼睛盯着这个可爱的DP方程30秒
原DP方程biu~~一下变成了
// 其中除号是整除,请委屈地捏着鼻子看完
对着
啊好简单,为什么要写那么简单的题的题解呢
因为我只会做简单题呀
0 0
- [BZOJ4658]rescue
- [bzoj4658]rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Rescue
- Android--菜单详解
- 用print在canvas自定义View实现飘雪花,多色雪花功能。
- 如何使用SSH登录远程服务器
- 缓存数据库redis安装
- LeetCode 13 -- Roman to Integer
- [BZOJ4658]rescue
- JZOJ【3072】【NOIP2012模拟10.31】掷骰子
- unity - 对象池技术的实现与应用
- UVa OJ 11093 - Just Finish it up
- 思维导图
- JavaScript阻止事件冒泡和默认事件
- ListView的多布局和GridView
- java 通过jdbc驱动连接hive操作实例
- LightOJ1067 Combinations Lucas定理裸题