很简单的一道题目,直接代码
#include<iostream>
#include<stdio.h>
using namespace std;
#define INT_MAX 0x7fffffff
#define INT_MIN 0x80000000
int main()
{
int x,y;
int minx,miny;
int maxx,maxy;
minx = miny = INT_MAX;
maxx = maxy = INT_MIN;
bool flag;
while(scanf("%d%d",&x,&y) != EOF )
{
if(x==0 && y ==0)
{
if(flag)
{
break;
}
printf("%d %d %d %d\n",minx,miny,maxx,maxy);
minx = miny = INT_MAX;
maxx = maxy = INT_MIN;
flag = true;
}
else
{
flag = false;
if(x<minx)
{
minx = x;
}
if(y<miny)
{
miny = y;
}
if(x>maxx)
{
maxx = x;
}
if(y>maxy)
{
maxy = y;
}
}
}
return 0;
}