# G--我要去内蒙古大草原

G--我要去内蒙古大草原

``````2
0
900
8
1400
1200
1000
800
600
400
200
0
0
``````

``````IMPOSSIBLE
POSSIBLE
``````

``````#include<stdio.h>
int main(){
int i,j,a[1422];
int n;
while(~scanf("%d",&n))
{
if(!n)break;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
if(a[i]>a[j])
{
int t=a[i];
a[i]=a[j];
a[j]=t;
}
a[n]=(1422-a[n-1])*2;
for(i=n-1;i;i--)
a[i]=a[i]-a[i-1];
a[0]+=200;
for(i=0;i<=n;i++)
if(a[i]>200)
break;
printf(i!=n+1?"IMPOSSIBLE\n":"POSSIBLE\n");
}
return 0;}``````

``````#include <iostream>
using namespace std;
int main()
{
int T,i,j,temp;
int dis[1423];
while((cin>>T)&&T!=0)
{
for(i=0;i<T;i++)
{
cin>>dis[i];
}
for(i=0;i<T;i++)
{
temp=i;
for(j=i;j<T;j++)
{
if(dis[temp]>dis[j])
temp=j;
}
j=dis[i];
dis[i]=dis[temp];
dis[temp]=j;
}
for(i=0;i<T-1;i++)
{
if(dis[0]!=0)
{
cout<<"IMPOSSIBLE"<<endl;
break;
}
if((dis[i+1]-dis[i])>200)
{
cout<<"IMPOSSIBLE"<<endl;
break;
}
if((dis[T-1]+200)<1422)
{
cout<<"IMPOSSIBLE"<<endl;
break;
}
if(2*(1422-dis[T-1])>200)
{
cout<<"IMPOSSIBLE"<<endl;
break;
}
}
if(i==T-1)
cout<<"POSSIBLE"<<endl;
}
return 0;
}
``````