hdu 2335 Containers
水题,就不解释了,不过这个题有一点很好,就是枚举的时候,枚举宽,也就是列数,因为这样才能越来越接近正方形
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<vector>
#define maxn 5000
#define MAXN 2005
#define MAXM 20000005
#define INF 100000000000000
#define oo 1000000007
using namespace std; typedef long long LL;
int main()
{
int t;
while(scanf("%d",&t)!=EOF)
{
while(t--)
{
LL n,x,y;
LL min_n=INF;
scanf("%I64d",&n);
n=(n+)/;
LL tem=(LL)sqrt(double(n));
for(LL i=; i<=tem; i++)
{
LL j=(n+(i-))/i;
LL xx=i*+(i+)*;
LL yy=j*+(j+)*;
//printf("%I64d %I64d %I64d %I64d\n",i,j,xx,yy);
if(xx*yy<min_n)
{
x=xx;
y=yy;
min_n=xx*yy;
}
else if(xx*yy==min_n)
{
if(abs(x-y)>abs(xx-yy))
{
x=xx;
y=yy;
}
}
}
printf("%I64d X %I64d = %I64d\n",max(x,y),min(x,y),min_n); }
}
return ;
}
hdu 2335 Containers的更多相关文章
- HDU 1399 Starship Hakodate-maru(暴力搜索)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1399 Starship Hakodate-maru Time Limit: 2000/1000 MS ...
- IBM Bluemix体验:Containers持久存储
上一篇介绍了在Bluemix Containers服务中使用docker hub镜像和container的高可用配置.接下来我们尝试如何在容器中使用持久存储. 在Bluemix的Containers服 ...
- IBM Bluemix体验:Containers进阶
上一篇中介绍了Bluemix的Containers服务以及如何使用自定义的docker image创建一个容器实例并对外提供服务.除了自定义镜像之外,Bluemix Containers还可以使用Do ...
- IBM Bluemix体验:Containers
国际版的Bluemix目前有三个region,US South,United Kingdom和Sydney.其中US South是功能最全的,UK其次,Sydney功能最少.Containers服务在 ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
随机推荐
- 喜讯!Ubuntu 16.10(Yakkety Yak) Final Beta发布喽!!!
上月三十日,代号为"Yakkety Yak"的Ubuntu 16.10发行版本的Final Beta正式上线.Canonical的开发者Steve Langasek说道:" ...
- mrg_myIsam分表引擎用法
CREATE TABLE `test`.`article_0` ( `id` BIGINT( 20 ) NOT NULL , `subject` VARCHAR( 200 ) NOT NULL , ` ...
- 安装svnx2出现 Make sure an svn tool (≥ v1.6) is present in the folder: “/usr/bin”
安装svnx2出现 Make sure an svn tool (≥ v1.6) is present in the folder: “/usr/bin” 是因为svnx2需要用到svn的地址,修改为 ...
- Servlet上
JavaWeb应用的概念 Java Web应用由一组Servlet.HTML页.类.以及其它可以被绑定的资源构成.它可以在各种供应商提供的实现Servlet规范的 Servlet容器 中运行. Jav ...
- 后台框架--HUI 的学习跟使用1
下载跟查看说明文档:官方 https://github.com/jackying/ 官网:http://www.h-ui.net/H-ui.admin.shtml 后台,http://www.h-ui ...
- 到目前为止,Linux下最完整的Samba服务器配置攻略 (转)
http://blog.chinaunix.net/uid-23069658-id-3142052.html 安装平台为UBUNTU 14.04,直接软件中心安装samba, service smb ...
- HTML特殊符号对应代码
HTML中的特殊符号所对应代码,收藏使用 符号 HTML 符号 HTML & & < < > > ⁄ ⁄ " " ¸ ¸ ° ° ½ ...
- Hibernate缓存机制 (2013-07-02 13:51:32)转载▼
标签: java web hibernate 缓存 代码 分类: javaweb 缓存是位于应用程序与物理数据源之间,用于临时存放复制数据的内存区域,目的是为了减少应用程序对物理数据源访 ...
- SharePoint表单和工作流 - Nintex篇(六)
博客地址 http://blog.csdn.net/foxdave 接上篇点击打开链接 在工作流Action的配置对话框中,点击"Edit with Nintex Forms",上 ...
- XCode之entitlement
entitlement是codesign的一个输入,参见:codesign. entitlement的意思是权力,也就是表明应用所具有的权利,可以访问什么,不能访问什么等.这些信息会在codesign ...