之前做的时候没想出来...现在来数学推导一波。

题意:从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的更多相关文章

  1. CF1027C Minimum Value Rectangle 贪心 数学

    Minimum Value Rectangle time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  2. CF1027C Minimum Value Rectangle【贪心/公式化简】

    https://www.luogu.org/problemnew/show/CF1027C #include<cstdio> #include<string> #include ...

  3. [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 ...

  4. 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 ...

  5. 【leetcode】963. Minimum Area Rectangle II

    题目如下: Given a set of points in the xy-plane, determine the minimum area of any rectangle formed from ...

  6. 963. Minimum Area Rectangle II

    Given a set of points in the xy-plane, determine the minimum area of any rectangle formed from these ...

  7. 【LeetCode】963. Minimum Area Rectangle II 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 线段长+线段中心+字典 日期 题目地址:https: ...

  8. 【CF1027C】Minimum Value Rectangle(贪心,数学)

    题意:给定n根木棍,不允许拼接或折断,选择四根组成矩形,求所有合法矩形中周长平方与面积比最小的一个,输出拼成这个矩形的四根木棍 n<=1e6 思路:猜结论:答案必定从相邻的4根中产生 证明见ht ...

  9. [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 ...

随机推荐

  1. 20155313 杨瀚 《网络对抗技术》实验八 Web基础

    20155313 杨瀚 <网络对抗技术>实验八 Web基础 一.实验目的 1.Web前端HTML 能正常安装.启停Apache.理解HTML,理解表单,理解GET与POST方法,编写一个含 ...

  2. AngularJS+bootstrap-switch 实现开关控件

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. [LOJ#6066]. 「2017 山东一轮集训 Day3」第二题[二分+括号序列+hash]

    题意 题目链接 分析 首先二分,假设二分的答案为 \(mid\),然后考虑利用括号序列来表示树的形态. 点 \(u\) 的 \(k-\) 子树的括号序列表示实际上是刨去了 \(u\) 子树内若干个与 ...

  4. [BZOJ4082][Wf2014]Surveillance[倍增]

    题意 给你一个长度为 \(len\) 的环,以及 \(n\) 个区间,要你选择尽量少的区间,使得它们完全覆盖整个环.问最少要多少个区间. \(len,n\leq 10^6\) . 分析 考虑普通的区间 ...

  5. 未能使用“Csc”任务的输入参数初始化该任务

    今天.NetCore2.1版本,建立Asp.net Core web应用程序项目时,报以下错误: 未能使用“Csc”任务的输入参数初始化该任务. “Csc”任务不支持“SharedCompilatio ...

  6. Sqlserver_分组

    create table orders ( id int, orderName varchar() ) go create table cars ( id ,) , ordersid int, pna ...

  7. ace -- api

    Ace The main class required to set up an Ace instance in the browser. 在浏览器中设置一个ace实例所需要的主要类. Methods ...

  8. CodeMirror 小册子

    User manual and reference guide      version 5.41.1 用户手册和参考指南 CodeMirror is a code-editor component ...

  9. C++ 多态Polymorphism 介绍+动态绑定、静态绑定

    什么是多态? 多态(polymorphism)一词最初来源于希腊语polumorphos,含义是一种物质的多种形态. 在专业术语中,多态是一种运行时绑定机制(run-time binding) ,通过 ...

  10. Daily Scrum NO.1

    工作概况 符美潇(PM): 今日工作 1.根据开发进程分配第一步开发工作,对相应的成员提出今日的开发要求:要求成员自己所负责的线程池,动态爬取,去重,文件分类等部分进行资料的相关了解. 2.Daily ...