1 static int wing=[]() 2 { 3 std::ios::sync_with_stdio(false); 4 cin.tie(NULL); 5 return 0; 6 }(); 7 8 class Solution 9 { 10 public: 11 vector<int> constructRectangle(int area) 12 { 13 vector<int> res; 14 int test=sqrt(area); 15 for(;test>0;test--) 16 { 17 if(area%test==0) 18 return {area/test,test}; 19 } 20 } 21 };
从开方出来的数一个个找