HDOJ 1859 怎么一直是WA,请大牛给我瞧瞧 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1859
#include<iostream>#include<fstream>#include<cmath>#include<cstring>#include<cstdio>#i...
#include<iostream>
#include<fstream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include <vector>
#include<climits>
using namespace std;
#define M 2010
#define N 30
int main()
{
FILE *fin,*fout;
//fin=fopen("data.in.txt","rb");
//fout=fopen("data.out.txt","wb");
fin=stdin;
fout=stdout;
////////////
int a,b;
int x1,x2,y1,y2;
while(fscanf(fin,"%d %d",&a,&b),a&&b)
{
x1=x2=a;
y1=y2=b;
while(fscanf(fin,"%d %d",&a,&b),a&&b)
{
if(x1>a)
x1=a;
if(x2<a)
x2=a;
if(y1>b)
y1=b;
if(y2<b)
y2=b;
}
fprintf(fout,"%d %d %d %d\n",x1,y1,x2,y2);
}
/////////
fclose(fin);
fclose(fout);
return 0;
} 展开
#include<fstream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include <vector>
#include<climits>
using namespace std;
#define M 2010
#define N 30
int main()
{
FILE *fin,*fout;
//fin=fopen("data.in.txt","rb");
//fout=fopen("data.out.txt","wb");
fin=stdin;
fout=stdout;
////////////
int a,b;
int x1,x2,y1,y2;
while(fscanf(fin,"%d %d",&a,&b),a&&b)
{
x1=x2=a;
y1=y2=b;
while(fscanf(fin,"%d %d",&a,&b),a&&b)
{
if(x1>a)
x1=a;
if(x2<a)
x2=a;
if(y1>b)
y1=b;
if(y2<b)
y2=b;
}
fprintf(fout,"%d %d %d %d\n",x1,y1,x2,y2);
}
/////////
fclose(fin);
fclose(fout);
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询