构造矩形(力扣

int* constructRectangle(int area, int* returnSize){
    int l,w=0;
    int* ret=(int*)calloc(2,sizeof(int));
    * returnSize=2;
    for(w=1;w<=pow(area,0.5);w++)
        if(area%w==0)ret[0]=area/w,ret[1]=w;

    return ret;
}

你可能感兴趣的:(leetcode,算法,c++)