详见:https://leetcode.com/problems/construct-the-rectangle/description/

C++:

class Solution {
public:
vector<int> constructRectangle(int area) {
int l=sqrt(area),w=sqrt(area);
while(l*w!=area)
{
if(l*w<area)
{
++l;
}
else
{
--w;
}
}
return {l,w};
}
};

参考:https://blog.csdn.net/liuchuo/article/details/54669517

492 Construct the Rectangle 构建矩形的更多相关文章

  1. [LeetCode] Construct the Rectangle 构建矩形

    For a web developer, it is very important to know how to design a web page's size. So, given a speci ...

  2. 【leetcode】492. Construct the Rectangle

    problem 492. Construct the Rectangle 参考 1. Leetcode_492. Construct the Rectangle; 完

  3. 【LeetCode】492. Construct the Rectangle 解题报告(Java & Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 Java解法 python解法 日期 题目地址:ht ...

  4. LeetCode - 492. Construct the Rectangle

    For a web developer, it is very important to know how to design a web page's size. So, given a speci ...

  5. [LeetCode&Python] Problem 492. Construct the Rectangle

    For a web developer, it is very important to know how to design a web page's size. So, given a speci ...

  6. LeetCode: 492 Construct the Rectangle(easy)

    题目: or a web developer, it is very important to know how to design a web page's size. So, given a sp ...

  7. Leetcode492.Construct the Rectangle构造矩形

    作为一位web开发者, 懂得怎样去规划一个页面的尺寸是很重要的. 现给定一个具体的矩形页面面积,你的任务是设计一个长度为 L 和宽度为 W 且满足以下要求的矩形的页面.要求: 1. 你设计的矩形页面必 ...

  8. 492. Construct the Rectangle

    static int wing=[]() { std::ios::sync_with_stdio(false); cin.tie(NULL); ; }(); class Solution { publ ...

  9. LeetCode——Construct the Rectangle

    LeetCode--Construct the Rectangle Question For a web developer, it is very important to know how to ...

随机推荐

  1. 机器学习经典算法具体解释及Python实现--K近邻(KNN)算法

    (一)KNN依旧是一种监督学习算法 KNN(K Nearest Neighbors,K近邻 )算法是机器学习全部算法中理论最简单.最好理解的.KNN是一种基于实例的学习,通过计算新数据与训练数据特征值 ...

  2. MyCAT简单入门配置

    MyCAT简单入门配置 安装jdk 建议1.7以上 安装mysql 安装MyCAT Mycat 源码:https://github.com/MyCATApache/Mycat-Server Mycat ...

  3. Pattern: Microservice Architecture

    Microservice Architecture pattern http://microservices.io/patterns/microservices.html Context You ar ...

  4. eclipse 修改代码后无法生效,需要clean后才能生效的解决办法

    勾选project-->Bulid Automatically选项(自动编译)

  5. 优秀Java程序员必须了解的GC工作原理

    一个优秀的Java程序员必须了解GC的工作原理.如何优化GC的性能.如何与GC进行有限的交互,因为有一些应用程序对性能要求较高,例如嵌入式系统.实时系统等,只有全面提升内存的管理效率 ,才能提高整个应 ...

  6. POJ1426 Find The Multiple —— BFS

    题目链接:http://poj.org/problem?id=1426 Find The Multiple Time Limit: 1000MS   Memory Limit: 10000K Tota ...

  7. HDU 1257:最少拦截系统

    最少拦截系统 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

  8. 【原】WPF客户端只能启动一次

    public partial class App : Application { System.Threading.Mutex mutex; public App() { this.Startup + ...

  9. 基于jQuery仿淘宝产品图片放大镜特效

    在开发商城的时候,往往会用到图片的放大功能,这里把自己在近期项目中使用的放大镜特效做一下总结(非插件). 放大镜效果 常用的js组件jquery.imagezoom,jquery.jqzoom,jqu ...

  10. I.MX6 Android busybox 从哪里生成的

    /**************************************************************************** * I.MX6 Android busybo ...