Hi,
I am getting WA. Please help me.
Here is my code:
#include <cstdio>
int main()
{
long n;
while(scanf("%ld",&n)==1)
{
if(n==0) break;
long station[100000],I,J,fag=1;
for(I=0 ; I<n ; I++)
{
scanf("%ld",&station[I]);
}
for(long i=1 ; i<n ; i++)
for(long j=0 ; j<n-i ; j++)
{
if(station[j]>station[j+1])
{
long temp=station[j];
station[j]=station[j+1];
station[j+1]=temp;
}
}
long dis=0;
for(J=0 ; J<n-1 ; J++)
{
dis=station[J+1]-station[J];
if(dis>200 || dis<-200 || station[n-1]+200<1422 || station[0]>200)
{
fag=0;
break;
}
}
if(fag==0)
printf("IMPOSSIBLE\n");
else
printf("POSSIBLE\n");
fag=1;
}
return 0;
}
created
last reply
- 1
reply
- 1.0k
views
- 2
users