表面积最小(POJ3536)
2024-09-04 16:25:00
题目链接: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 ;
}
最新文章
- 轻量级应用开发之(03)UIVIew
- C++ 关键字 explicit, export, mutable
- 剑指offer系列40----机器人的运动范围
- Contest2037 - CSU Monthly 2013 Oct (Problem J: Scholarship)
- 接收Firfox RESTClient #Post请求
- DedeCms autoindex和itemindex使用介绍
- windows 下,用CreateWaitableTimer SetWaitableTimer 创建定时器(用轮询的办法保持高精度)
- C语言字符串函数大全
- QTREE - Query on a tree
- 老李分享:robotium3.6与4.0 later 的区别 1
- Spring MVC的配置与DispatcherServlet的分析
- OpenCV图片矩阵操作相关,对png图片操作(多通道)
- SWAP_JOIN_INPUTS Oracle Hint(处理hash join强制大表(segment_size大)作为被驱动表)
- float/double 浮点数据*100精度丢失问题
- 了解Python内存管理机制,让你的程序飞起来
- JS参数转发
- 【BZOJ1055】[HAOI2008]玩具取名(动态规划)
- Spark SQL metaData配置到Mysql
- freeRadius与NetGear WNAP210的简使用
- c# combobox控件的使用
热门文章
- 4.会话管理(Session)
- 用vector实现二维向量
- grep常用选项记录
- 基础 —— ip地址与子网掩码的认识
- 以sqlplus管理员权限登陆oracle
- C# 控制反转(IOC: Inverse Of Control) &; 依赖注入(DI: Independence Inject)
- Robot Framework自动化测试(一)
- Thread 1 cannot allocate new log, sequence 187398
- Robotframework测试相关库
- CSAPP阅读笔记-链接-第七章-P464-P500