#include<stdio.h>
main()
{
int i,j,k,p,W;
float x,y,r[10][4];
char s;
for(i=0;;i++)
{
scanf("%c",&s);
if(s=='*')
break;
scanf("%f %f %f %f",&r[i][0],&r[i][1],&r[i][2],&r[i][3]);
}
for(p=1;;p++)
{
scanf("%f %f",&x,&y);
if(x>9999&&y>9999)
break;
W=1;
for(k=0;k<i;k++)
{
if(x>r[k][0]&&y<r[k][1]&&x<r[k][2]&&y>r[k][3])
{
printf("Point %d is contained in figure %d\n",p,k/2+1);
W=0;
}
}
if(W)
printf("Point %d is not contained in any figure\n",p);
}
}
我的i值一直有問題
#include
main()
{
int i,j,k,p,W;
float x,y,r[10][4];
char s;
for(i=0;;i++)
{
scanf("%c",&s);
if(s=='*')
break;
scanf("%f %f %f %f",&r[i][0],&r[i][1],&r[i][2],&r[i][3]);
}
for(p=1;;p++)
{
scanf("%f %f",&x,&y);
if(x>9999&&y>9999)
break;
W=1;
for(k=0;k
{
if(x>r[k][0]&&yr[k][3])
{
printf("Point %d is contained in figure %d\n",p,k/2+1);
W=0;
}
}
if(W)
printf("Point %d is not contained in any figure\n",p);
}
}
我的i值一直有問題
我 c 沒那麼熟, 但是我這邊的 java 程式碼貼過去 acm 是有過的.
說不定那邊測資的點有 9999.8 9999.8 吧.