题目链接:http://poj.org/problem?id=3536

在体积固定的情况下,表面积最小时的长,宽,高。

这里枚举长,宽,根据体积计算高。

#include <iostream>
#include <algorithm> using namespace std; int x=,y=; void f(int n)
{
int min=0x3f3f3f3f;
x=;
y=;
for(int i=; i*i<=n; i++)
{
if(n%i==)
{
for(int j=i; i*j<=n; j++)
if(n%(i*j)==)
{
int t=*(i*j+i*(n/(i*j))+j*(n/(i*j)));
if(t<min)
{
min=t;
x=i;
y=j;
}
}
}
}
}
int main()
{
int n;
cin>>n;
f(n);
cout<<x<<' '<<y<<' '<<n/(x*y)<<endl;
return ;
}

最新文章

  1. 轻量级应用开发之(03)UIVIew
  2. C++ 关键字 explicit, export, mutable
  3. 剑指offer系列40----机器人的运动范围
  4. Contest2037 - CSU Monthly 2013 Oct (Problem J: Scholarship)
  5. 接收Firfox RESTClient #Post请求
  6. DedeCms autoindex和itemindex使用介绍
  7. windows 下,用CreateWaitableTimer SetWaitableTimer 创建定时器(用轮询的办法保持高精度)
  8. C语言字符串函数大全
  9. QTREE - Query on a tree
  10. 老李分享:robotium3.6与4.0 later 的区别 1
  11. Spring MVC的配置与DispatcherServlet的分析
  12. OpenCV图片矩阵操作相关,对png图片操作(多通道)
  13. SWAP_JOIN_INPUTS Oracle Hint(处理hash join强制大表(segment_size大)作为被驱动表)
  14. float/double 浮点数据*100精度丢失问题
  15. 了解Python内存管理机制,让你的程序飞起来
  16. JS参数转发
  17. 【BZOJ1055】[HAOI2008]玩具取名(动态规划)
  18. Spark SQL metaData配置到Mysql
  19. freeRadius与NetGear WNAP210的简使用
  20. c# combobox控件的使用

热门文章

  1. 4.会话管理(Session)
  2. 用vector实现二维向量
  3. grep常用选项记录
  4. 基础 —— ip地址与子网掩码的认识
  5. 以sqlplus管理员权限登陆oracle
  6. C# 控制反转(IOC: Inverse Of Control) &amp; 依赖注入(DI: Independence Inject)
  7. Robot Framework自动化测试(一)
  8. Thread 1 cannot allocate new log, sequence 187398
  9. Robotframework测试相关库
  10. CSAPP阅读笔记-链接-第七章-P464-P500