2099_Frame Polygonal Line(测试正确但是wrong answer,求解)(对输入格式的控制)
来源:互联网 发布:js把字符串转化成日期 编辑:程序博客网 时间:2024/05/20 08:21
You are going to read a sequence of pairs of integer numbers. Each pair represents the Cartesian coordinates of a point in a 2-dimentional plane. The first number is the x coordinate, while the second is that of y. The sequence represents a polygonal line. Your task is to draw a rectangle with minimal length of sides that exactly surrounds the polygonal line. The sides of the rectangle are parallel to x- and y-axis, respectively.
Input
Input consists of several test cases. For each case, a sequence of coordinates is given. Each pair of x and y occupies a line, with |x| and |y| less than 2^31. The sequence is terminated with a pair of 0's. Note that (0, 0) will never be considered as a point on any of the polygonal lines. An empty polygonal line signals the end of input.
Output
For each test case, print in one line two pairs of numbers, which are the south-west and north-east corners of the surrounding rectangle. The numbers must be separated by one space as is indicated in the samples.
Sample Input
12 56
23 56
13 10
0 0
12 34
0 0
0 0
Sample Output
12 10 23 56
12 34 12 34
Author: WENG, Kai
Source: Zhejiang University Local Contest 2004
***************************************************************************************************************
//找出最小的x,y最大的x,y输出
#include<iostream>
using namespace std;
int main()
{
int x_max,x_min,y_max,y_min;
int x,y;
bool flag1,flag2;
while(true)
{
flag1=flag2=true;
while(cin>>x>>y&&x&&y)
{
flag2=false;//标记连续输入两对0的情况
if(flag1)//输入的第一次,有别于其他
{
x_max=x_min=x;
y_max=y_min=y;
flag1=false;
continue;
}
if(x>x_max)
x_max=x;
if(x<x_min)
x_min=x;
if(y>y_max)
y_max=y;
if(y<y_min)
y_min=y;
}
if(flag2)
break;
cout<<x_min<<" "<<y_min<<" "<<x_max<<" "<<y_max<<endl;
}
return 0;
}
- 2099_Frame Polygonal Line(测试正确但是wrong answer,求解)(对输入格式的控制)
- zoj 2099 Frame Polygonal Line
- ZOJ 2099 Frame Polygonal Line
- zoj 2099 Frame Polygonal Line
- zoj 2099 Frame Polygonal Line
- zoj2099------------------------Frame Polygonal Line
- poj1001在测试他给的数据结果一模一样,但总是wrong answer
- 判断输入的IP格式是否正确
- wrong answer 原因
- poj 1035(Wrong Answer)
- poj1001 Wrong Answer
- 关于UVa Online Judge提交总是Wrong answer的问题
- 输入/输出 格式的控制_C++
- C++ Stream 的输入/输出格式控制
- C中输入格式的控制
- js函数实现输入格式的控制
- 判断输入框的输入格式是否正确,并禁止其他输入框输入内容
- wrong answer of URAL 1802
- Ext.button的CSS怎么能让图片全部显示
- 地震真的不可预测吗?
- Ubuntu卸载旧内核
- 无平方因子的数(数论初步) By ACReaper
- debian 安装 jdk
- 2099_Frame Polygonal Line(测试正确但是wrong answer,求解)(对输入格式的控制)
- 设置debian系统的apt
- boost::ublas之Matrix定义
- oracle数据库
- poj_3923Ugly Windows
- MySQL更改表结构的添加与删除
- 快速幂
- debian系统配置LAMP环境及测试
- JNI jstring 和char* 的相互转换