492 Construct the Rectangle 构建矩形
详见: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 构建矩形的更多相关文章
- [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 ...
- 【leetcode】492. Construct the Rectangle
problem 492. Construct the Rectangle 参考 1. Leetcode_492. Construct the Rectangle; 完
- 【LeetCode】492. Construct the Rectangle 解题报告(Java & Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 Java解法 python解法 日期 题目地址:ht ...
- 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 ...
- [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 ...
- 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 ...
- Leetcode492.Construct the Rectangle构造矩形
作为一位web开发者, 懂得怎样去规划一个页面的尺寸是很重要的. 现给定一个具体的矩形页面面积,你的任务是设计一个长度为 L 和宽度为 W 且满足以下要求的矩形的页面.要求: 1. 你设计的矩形页面必 ...
- 492. Construct the Rectangle
static int wing=[]() { std::ios::sync_with_stdio(false); cin.tie(NULL); ; }(); class Solution { publ ...
- LeetCode——Construct the Rectangle
LeetCode--Construct the Rectangle Question For a web developer, it is very important to know how to ...
随机推荐
- [a,s]=[22,3]
[a,s]=[22,3] Object.assign() - JavaScript | MDN https://developer.mozilla.org/en-US/docs/Web/JavaScr ...
- throw 、throws 简介
抛出异常抛出异常有三种形式,一是throw,一个throws,还有一种系统自动抛异常.下面它们之间的异同.系统自动抛异常当程序语句出现一些逻辑错误.主义错误或类型转换错误时,系统会自动抛出异常.如: ...
- linq to xml There are multiple root elements.
添加xml结点的时候 var temp2 = temp1.Element("staticContent"); if (temp2 != null) { string str = & ...
- 使用pyinstaller----python转exe
自己写了一个定时清理日志的脚步,因为服务器是Windows,不想部署Python环境,就考虑到转成exe文件即可. 从网上了解到python转exe方法比较多,我选用了pyinstaller,过程比较 ...
- Tomcat 系统架构与设计模式之二
Tomcat 系统架构与设计模式,第 2 部分: 设计模式分析 来自:http://www.ibm.com/developerworks/cn/java/j-lo-tomcat2/ 这个分为两个部分的 ...
- 西交校赛 I. GZP and CS(数位dp)
I. GZP and CS GZP love to play Counter-Strike(CS). One day GZP was playing a mod of CS. The counter- ...
- bzoj 3073 Journeys —— 线段树优化连边
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3073 建两棵线段树,一棵从下往上连边,一棵从上往下连边,叶子节点之间也有连边: 区间向区间连 ...
- Laravel配置nginx环境
前言: 之前坑的!一直在尝试配置,但都失败了,只能用着apache,但是最近想整合swoole到laravel,无奈当前测试服务器是nginx,我只能再尝试在nginx上搭laravel环境 方法如下 ...
- View Programming Guide for iOS ---- iOS 视图编程指南(四)---Views
Views Because view objects are the main way your application interacts with the user, they have many ...
- Android应用开发基础篇(12)-----Socket通信(转载)
转自:http://www.devdiv.com/android_socket_-blog-258060-10594.html 一.概述 网络通信无论在手机还是其他设备上都应用得非常广泛,因此掌握网络 ...