题解 | #最小长方形#
最小长方形
https://www.nowcoder.com/practice/dc6a75a15d1948edafa6d63bc8fc2368
#include <iostream> #include <vector> #include<algorithm> using namespace std; int main() { int a, b; vector<int> xx,yy; while (cin >> a >> b) { // 注意 while 处理多个 case if(a==0&&b==0){ if(xx.size()==0){ continue; } sort(xx.begin(),xx.end()); sort(yy.begin(),yy.end()); cout<<xx[0]<<" "<<yy[0]<<" "<<*(xx.end()-1)<<" "<<*(yy.end()-1)<<endl; xx.clear(); yy.clear(); } else{ xx.push_back(a); yy.push_back(b); } } } // 64 位输出请用 printf("%lld")