daydayup2 codeforces143C
题意:给你n= (A - 1) × (B - 2) × (C - 2),求A*B*C的最大值和最小值
思路:要用好的姿势暴力
#include "stdio.h"
#include "string.h"
#define inf 10000000000
int main()
{
long long i,j,k,min,max,n;
while(scanf("%I64d",&n)==)
{
min=inf;
max=(n+)*-n;
for(i=;i*i*i<=n;i++)
{
if(n%i==)
{
for(j=i;j*j<=n/i;j++)
if((n/i)%j==)
{
if((i+)*(j+)*(n/i/j+)-n<min)
min=(i+)*(j+)*(n/i/j+)-n;
}
}
}
printf("%I64d %I64d\n",min,max);
}
return ;
}
daydayup2 codeforces143C的更多相关文章
- daydayup2 codeforces143D
这题很考察分析 题意:让你构造n*m的矩阵,使得不存在两个点的距离的平方为5 1若n=1 ,答案为m 2若m=1,答案为n 3若n=2 则这样 110011001100.. 110011001100 ...
随机推荐
- android 加载网络图片
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- android Fragment 使用
一 .Fragment的理解 Fragment 与activity 相似,但比activity 多出几个方法 ,Fragment的生命周期小于activity 一个Activity 中可以包含多个Fr ...
- 关于 DevExpress.XtraTreeList.TreeList 树形控件 的操作
作为一个C#程序员,在写程序时一直以来都使用的微软那一套控件,用起来特别爽,可是最近公司的一个项目用到了DevExpress框架,不用不知道,一用吓一跳,不得不承认这个框架确实很强大,效果也很炫,但是 ...
- nginx+lua实现简单的waf网页防火墙功能
原文:http://www.2cto.com/net/201608/534272.html 安装LuaJIT http://luajit.org/download/LuaJIT-2.0.4.tar.g ...
- 【分享】图解Windows Server 2012 R2 配置IIS 8全过程
最近计划更换服务器,包括IIS服务器与数据库服务器,操作系统都是Windows Server 2012 R2,第一次接触Windows Server 2012,感觉比较新鲜,一路摸索完成了IIS 8 ...
- Node聊天程序实例01
作者:vousiu 出处:http://www.cnblogs.com/vousiu 本实例参考自Mike Cantelon等人的<Node.js in Action>一书. 本实例要实现 ...
- iOS - CoreLocation 定位
前言 NS_CLASS_AVAILABLE(10_6, 2_0) @interface CLLocationManager : NSObject 1.CoreLocation 定位 配置 1.在 iO ...
- js小程序写法优化
(function(){ var gcld_but = document.getElementById("gcld_but"), gcld_but_li = gcld_but.ge ...
- 《爵迹》侵权链接多为个人用户分享到个人网盘 总结说明:推广途径为 网盘>微博>博客>贴吧>知道
网络侵权链接3318条.该片的侵权范围分布相对较均匀,其中微博/博客侵权链接630条.占比19%:贴吧778条.占比23.4%:知道513条.占比15.4%:网盘828条.占比25%:小网站410条. ...
- k.APR通道特殊配置
APR/native specific configuration The following attributes are specific to the APR/native connector. ...