Steward
分享是一種喜悅、更是一種幸福
程式語言 - LeetCode - C++ - 492. Construct the Rectangle
題目:

解答:
class Solution {
public:
vector<int> constructRectangle(int area) {
int w = sqrt(area);
while (area % w) {
w -= 1;
}
return { area / w, w };
}
};