详见: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 构建矩形
原文:https://www.cnblogs.com/xidian2014/p/8904088.html