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