hdu1895(最小长方形)
#include<stdio.h> int main() { int x1,y1; int x,y; int xm,ym,xa,ya; while(scanf("%d %d",&x1,&y1)!=EOF&&(x1!=0||y1!=0)) { xm=x1;//最小的x xa=x1;//最大的y ym=y1; ya=y1; while(scanf("%d %d",&x,&y)!=EOF&&(x!=0||y!=0)) { if(x<xm)xm=x; if(x>xa)xa=x; if(y<ym)ym=y; if(y>ya)ya=y; } printf("%d %d %d %d\n",xm,ym,xa,ya); } }
x和y都为0时,为结束符!