• 主页

# 同一个用例，两次测试结果不一样！！跪求解释！！！

zhou0818 2010-07-27 10:15:56

Problem Description

Input

Output

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
——————————————————————————————————————

``````#include <stdio.h>
int main()
{
int a,b,m1,m2,n1,n2;

scanf("%d%d",&a,&b);

while(scanf("%d%d",&a,&b)!=EOF)
{
m1=231;
n1=231;
m2=-231;
n2=-231;

while(a&&b)
{
if(a<m1)
m1=a;
if(b<n1)
n1=b;
if(a>m2)
m2=a;
if(b>n2)
n2=b;

scanf("%d%d",&a,&b);
}
printf("%d %d %d %d\n",m1,n1,m2,n2);
}

return 0;
}``````

...全文
202 1 收藏 17

17 条回复

The_Only_Name_2 2010-07-31

The_Only_Name_2 2010-07-30

printf("The rectangle is %d,%d and %d,%d",hmin,vmin,hmax,vmax);
return 1;

The_Only_Name_2 2010-07-30

if(i==0) return 0;

The_Only_Name_2 2010-07-30

``````
#define MAXNUM 30
#include <stdio.h>

int main()
{
int h[MAXNUM];//储存横坐标的点
int v[MAXNUM];//储存纵坐标的点
int i=0,j=1;//计数器

while()
{
scanf("%d%d",&h[i],&v[i]);
if(h[i]||v[i]) break;
i++;
}

if(i=0) return 0;
int hmin=h[0],hmax=h[0],vmin=v[0],vmax=v[0];
while(j<i)
{
hmin=hmin<h[j]?hmin:h[j];
hmax=hmax>h[j]?hmax:h[j];
vmin=vmin<v[j]?vmin:h[j];
vmax=vmax>v[j]?vmax:h[j];
}
printf("The rectangle is %d,%d and %d,%d",hmin,vmin,hmax,vmax);
return 0;
}
``````

zhou0818 2010-07-30

zhou0818 2010-07-30
[Quote=引用 11 楼 the_only_name_2 的回复:]

C/C++ code

#define MAXNUM 30
#include <stdio.h>

int main()
{
int h[MAXNUM];//储存横坐标的点
int v[MAXNUM];//储存纵坐标的点
int i=0,j=1;//计数器

……
[/Quote]

zhou0818 2010-07-30
[Quote=引用 10 楼 bulijun1987 的回复:]

[/Quote]

bulijun1987 2010-07-29

zhou0818 2010-07-29

[/Quote]

dahaiI0 2010-07-28

dahaiI0 2010-07-28

zhou0818 2010-07-28

zhou0818 2010-07-28
[Quote=引用 3 楼 dahaii0 的回复:]

[/Quote]

``````#include <stdio.h>
int main()
{
int a,b,m1,m2,n1,n2;

scanf("%d%d",&a,&b);

while(a&&b)
{
m1=231;
n1=231;
m2=-231;
n2=-231;

while(a&&b)
{
if(a<m1)
m1=a;
if(b<n1)
n1=b;
if(a>m2)
m2=a;
if(b>n2)
n2=b;

scanf("%d%d",&a,&b);
}
printf("%d %d %d %d\n",m1,n1,m2,n2);

scanf("%d%d",&a,&b);
}

return 0;
}``````

zhou0818 2010-07-28
[Quote=引用 4 楼 dahaii0 的回复:]

[/Quote]

``````#include <stdio.h>
int main()
{
int a,b,m1,m2,n1,n2;

scanf("%d%d",&a,&b);

while(a&&b)
{
m1=231;
n1=231;
m2=-231;
n2=-231;

while(a&&b)
{
if(a<m1)
m1=a;
if(b<n1)
n1=b;
if(a>m2)
m2=a;
if(b>n2)
n2=b;

scanf("%d%d",&a,&b);
}
printf("%d %d %d %d\n",m1,n1,m2,n2);

scanf("%d%d",&a,&b);
}

return 0;
}``````

xiaoqiang321 2010-07-28

VC/MFC

1.5w+

VC/MFC相关问题讨论