CF1027C Minimum Value Rectangle
之前做的时候没想出来...现在来数学推导一波。
题意:从n个木棒中选出4个拼成一个矩形,使得 (周长)2/面积 最小。
解:设矩形宽a长b。我们要最小化下面这个式子:

去掉常数,不妨设b = a + len,则化为下式:

取倒数,也就是最大化下式:

显然对于每个确定的a,len越小越好。所以直接取相邻的即可。
好像还有一种推导方法......
原式可直接化为a/b + b/a,这就是个耐克函数双钩函数,让a/b趋近1也就是a=b,所以a和b越接近越好。
CF1027C Minimum Value Rectangle的更多相关文章
- CF1027C Minimum Value Rectangle 贪心 数学
Minimum Value Rectangle time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- CF1027C Minimum Value Rectangle【贪心/公式化简】
https://www.luogu.org/problemnew/show/CF1027C #include<cstdio> #include<string> #include ...
- [Swift]LeetCode963. 最小面积矩形 II | Minimum Area Rectangle II
Given a set of points in the xy-plane, determine the minimum area of any rectangle formed from these ...
- LC 963. Minimum Area Rectangle II
Given a set of points in the xy-plane, determine the minimum area of any rectangle formed from these ...
- 【leetcode】963. Minimum Area Rectangle II
题目如下: Given a set of points in the xy-plane, determine the minimum area of any rectangle formed from ...
- 963. Minimum Area Rectangle II
Given a set of points in the xy-plane, determine the minimum area of any rectangle formed from these ...
- 【LeetCode】963. Minimum Area Rectangle II 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 线段长+线段中心+字典 日期 题目地址:https: ...
- 【CF1027C】Minimum Value Rectangle(贪心,数学)
题意:给定n根木棍,不允许拼接或折断,选择四根组成矩形,求所有合法矩形中周长平方与面积比最小的一个,输出拼成这个矩形的四根木棍 n<=1e6 思路:猜结论:答案必定从相邻的4根中产生 证明见ht ...
- [Swift]LeetCode939. 最小面积矩形 | Minimum Area Rectangle
Given a set of points in the xy-plane, determine the minimum area of a rectangle formed from these p ...
随机推荐
- 20155304《网络对抗》Exp8 Web基础
20155304<网络对抗>Exp8 Web基础 实践要求 (1).Web前端HTML 能正常安装.启停Apache.理解HTML,理解表单,理解GET与POST方法,编写一个含有表单的H ...
- vue-cli 动态绑定图片失败
1.template 中引用图片,第一个为固定路径,第二个为动态绑定路径 eg: <img src="XXXXXX.png" alt=""> < ...
- Python+Selenium爬取动态加载页面(2)
注: 上一篇<Python+Selenium爬取动态加载页面(1)>讲了基本地如何获取动态页面的数据,这里再讲一个稍微复杂一点的数据获取全国水雨情网.数据的获取过程跟人手动获取过程类似,所 ...
- 赚钱的小生意,VC对你没兴趣
创业者,赚钱的生意就不要去找VC(风险投资)了,因为人家对你的生意没有兴趣. 无论是创业者,VC,股权投资散户,都需要对一个"生意"的规模有个总体的认识. 就"生意&qu ...
- 《图说VR入门》——360全景视频
本文章由cartzhang编写,转载请注明出处. 所有权利保留. 文章链接:http://blog.csdn.net/cartzhang/article/details/53674647 作者:car ...
- asp.net mvc2+nhibernate实体类映射问题之“尝试创建Controller类型的控制器时出错请确保控制器具有无参数公共构造函数”
程序出了问题,解决后发现如此简单,犯的错误是如此的低级啊,特此记录! 运行程序总是在浏览器中看到一片空白,什么也没有,用application_error跟踪发现抓出一个这样的异常 然后浏览器中就是这 ...
- 纯 CSS 利用 label + input 实现选项卡
clip 属性 用于剪裁绝对定位元素. .class { position:absolute; clip:rect(0px,60px,200px,0px); } scroll-behavior: sm ...
- binary 和 varbinary 用法全解
在SQL Server中,使用数据类型 binary(n) 和 varbinary(n) 存储二进制数据,n是指字节数量: binary(n):固定长度为 n 字节,其中 n 值从 1 到 8,000 ...
- Spring+SpringMVC+MyBatis+easyUI整合优化篇(一)Java语言中System.out.print与Log的比较
作者:13 GitHub:https://github.com/ZHENFENG13 版权声明:本文为原创文章,未经允许不得转载. 前言 距离上一次更新博客有一段时间了,主要是因为最近有开发任务,另外 ...
- 深入了解Kubernetes REST API的工作方式
关于Kubernetes REST API的工作方式: 在哪里以及如何定义从REST路径到处理REST调用的函数的映射? 与etcd的交互发生在哪里? 从客户端发出请求到保存在etcd中对象的端到端路 ...