[Coursera]算法基础_Week9_考试_Q4
2015-12-15 23:55
330 查看
#include <iostream> #include <string.h> #include <math.h> using namespace std; #define INF 1000000 int main() { int C; cin >> C; while (C--) { int N; cin >> N; if (N == 0) cout << 0 << endl; int res = INF; for (int a = 1; a <=N; a++) { if (N%a != 0) continue; for (int b = 1; b <= N; b++) { if ((N / a) % b != 0) continue; int c = N / a / b; int temp = a*b + b*c + c*a; if (res > temp) res = temp; } } cout << res * 2 << endl; } return 0; }
相关文章推荐
- 删除EM,强制结束EM进程后,启动数据库ORA-00119,ORA-00132报错的解决方法
- 按下按钮圆圈改变颜色
- button作为asp.net服务器控件时在IE提交两次
- 关于Hello Minecraft! Launcher源代码的简介
- Unity3D中的系统调用方法
- 框架SSH学习(Struts)
- JavaDoc的使用
- 斯坦福机器学习2:监督学习应用
- http协议笔记
- vb常用函数一览表
- 打怪路线专用
- ABP理论学习之发布说明
- 通过表达式、函数给React组件属性赋值
- UVa 11082 - 最大流 基础建模
- android的interpolator用法
- php中instanceof的作用
- Hexo 主题使用进阶
- 【菜鸟初长成】之人生第一个JAVA程序
- SpringMVC接收参数的注解笔记
- jquery学习(五)-jquery中的事件