BZOJ
来源:互联网 发布:炉石大数据各数据意义 编辑:程序博客网 时间:2024/06/08 04:35
#include <algorithm>#include <iostream>#include <cstring>#include <cstdlib>#include <cstdio>#include <cmath>#include <set>using namespace std;typedef long long int LL;const LL INF = 1e18;const int N = 1000005;int n, r, p;LL dp[N];LL dfs(int n){ if (dp[n]) return dp[n]; if (n <= 1) return 0; dp[n] = (LL)(n - 1) * p + r; for (int i = 2; i < n;) { dp[n] = min((LL)(i - 1) * p + dfs(ceil(n * 1.0 / i)) + r, dp[n]); i = ceil(n * 1.0 / (ceil(n * 1.0 / i) - 1)); } return dp[n];}int main(){ //freopen("test.txt", "r", stdin); //freopen("out.txt", "w", stdout); scanf("%d%d%d", &n, &r, &p); printf("%I64d\n", dfs(n)); return 0;}
阅读全文
0 0
- [BZOJ ]
- BZOJ****-****
- BZOJ
- BZOJ
- BZOJ
- BZOJ
- BZOJ
- BZOJ
- BZOJ
- BZOJ
- BZOJ
- BZOJ
- bzoj
- bzoj
- BZOJ
- BZOJ
- bzoj
- BZOJ
- OkHttp用法
- Sort Colors
- 布局侧边栏
- 博弈问题外挂-SG函数
- Class的 getSuperclass与getGenericSuperclass区别和如何获取泛型参数类型
- BZOJ
- RecyclerView
- Android---Bannerd的基本使用
- 使可变性最小化。
- git撤销操作(git checkout; git reset)
- maven导入jar包报错解决办法之一
- Hashmap的容量为什么是2的幂次
- matlabday01
- Android RecyclerView 获取数据实现添加,删除功能