1209. Construct the Rectangle

Posted virgildevil

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了1209. Construct the Rectangle相关的知识,希望对你有一定的参考价值。

1209. Construct the Rectangle

class Solution {
public:
    /**
     * @param area: web pagea€?s area
     * @return: the length L and the width W of the web page you designed in sequence
     */
    vector<int> constructRectangle(int area) {
        // Write your code here
        int start = sqrt(area);
        while(area%start != 0 && start<area)
        {
            start ++;
        }
        vector<int> res;
        res.push_back(start);
        res.push_back(area/start);
        return res;
    }
};

以上是关于1209. Construct the Rectangle的主要内容,如果未能解决你的问题,请参考以下文章

492 Construct the Rectangle 构建矩形

492. Construct the Rectangle

492. Construct the Rectangle

492. Construct the Rectangle

492. Construct the Rectangle

Construct the Rectangle