CodeVS 1710 生日蛋糕 题解
来源:互联网 发布:免费英语网络课程 编辑:程序博客网 时间:2024/05/23 01:13
#include <cstdio>using namespace std;int N, M;int ans = ~0u>>1;bool flag;void DFS(int R, int H, int V, int S, int m){if(S>ans)return;if(V>R*R*H*m)return;if(m && !V)return;if(!m && V)return;if(R<m)return;if(H<m)return;if(V<0)return;if(m<0)return;if(V==0 && m==0){if(ans > S)ans = S, flag = true;return;}for(int r = R; r>=m; --r)for(int h = H; h>=m; --h)DFS(r-1, h-1, V-r*r*h, S+2*r*h, m-1);}int main() {scanf("%d %d", &N, &M);for(int R = 70; R>=M; --R)for(int H = (N/R/R); H>=M; --H)DFS(R-1, H-1, N-R*R*H, R*R+2*R*H, M-1);if(flag) printf("%d\n", ans);else printf("0\n");return 0;}
阅读全文
0 0
- CodeVS 1710 生日蛋糕 题解
- 生日蛋糕 (codevs 1710) 题解
- codevs 1710 生日蛋糕
- POJ1190生日蛋糕题解
- Codevs 1710 == POJ 1190 生日蛋糕 == 洛谷P1731
- codevs 2597 团伙 题解
- Codevs 1076 题解
- Codevs 1201 题解
- CodeVS 第四次月赛 题解
- Codevs 多米诺+覆盖题解
- 【codevs 1191】题解
- 【codevs 1369】题解
- 【codevs 2981】题解
- 【codevs 1690】题解
- CodeVS 1215 迷宫 题解
- CodeVS 3344 迷宫 题解
- CodeVS 1102 采药 题解
- 生日蛋糕
- 自定义DEBUG
- JS跨页面调用变量的方法
- 16 多校 8
- scrollTop clientTop offsetTop scrollHeight clientHeight clientWidth的区别及用法
- 怎样尊重一个程序员
- CodeVS 1710 生日蛋糕 题解
- 多态应用
- 课时3 命令行BASH的基本操作
- JDK安装和环境变量配置及问题
- linux系统禁ping
- 模拟页面模板引擎
- bzoj1003 物流运输
- 神经网络之LeNet网络结构(Python+TensorFlow)
- Eclipse下安装Scala插件