首页 > 其他 > 详细

1209. Construct the Rectangle

时间:2020-01-06 12:12:31      阅读:90      评论:0      收藏:0      [点我收藏+]

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

原文:https://www.cnblogs.com/virgildevil/p/12155486.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!