hdu 1859(计算几何)

/*

  Name: 计算几何 

  Author:  Try_86

  Date: 11/04/12 18:07

  Description: 求x,y的最大最小值即可 

*/



#include <cstdio>

#include <climits>

#include <iostream>



using namespace std;



int main() {

    int x, y, minx, miny, maxx, maxy;

    while (scanf("%d%d", &x, &y), x!=0 || y!=0){

        minx = INT_MAX;

        miny = INT_MAX;

        maxx = INT_MIN;

        maxy = INT_MIN;

        if (minx>x) minx = x;

        if (maxx<x) maxx = x;

        if (miny>y) miny = y;

        if (maxy<y) maxy = y;

        while (scanf("%d%d", &x, &y), x!=0 || y!=0) {

            if (minx>x) minx = x;

            if (maxx<x) maxx = x;

            if (miny>y) miny = y;

            if (maxy<y) maxy = y;

        }

        printf ("%d %d %d %d\n", minx, miny, maxx, maxy);

    }

    return 0;

}

 

你可能感兴趣的:(HDU)