1 / 11
Oct 2011

#include<iostream>
using namespace std;
int main()
{
	int n,i,a[1423],ok,aux,l;
	while(cin>>n&&n)
	{	
		for(i=1;i<=n;i++)
			cin>>a[i];
		if(n>=7)
		{
			a[++n]=1422;
			l=n;
			do
			{
				ok=1;
				for(i=0;i<l-1;i++)
					if(a[i]>a[i+1])
					{
						ok=0;
						aux=a[i];
						a[i]=a[i+1];
						a[i+1]=aux;
					}
				l--;	
			}while(!ok);
			ok=1;
			for(i=0;i<n;i++)
				if((a[i+1]-a[i])>200)
				{
					ok=0;
					cout<<"IMPOSSIBLE\n";
					break;
				}
			if(ok)
				cout<<"POSSIBLE\n";
		}
		else
			cout<<"IMPOSSIBLE\n";
	}
	return 0;
}

#include<iostream>
using namespace std;
int main()
{
	int n,i,a[1423],ok,aux,l;
	while(cin>>n&&n)
	{	
		for(i=1;i<=n;i++)
			cin>>a[i];
		l=n;
		do
		{
			ok=1;
			for(i=0;i<l-1;i++)
				if(a[i]>a[i+1])
				{
					ok=0;
					aux=a[i];
					a[i]=a[i+1];
					a[i+1]=aux;
				}
			l--;	
		}while(!ok);
		ok=1;
		if(1422-a[n]>100)
			cout<<"IMPOSSIBLE\n";
		else
		{
			for(i=0;i<n;i++)
				if((a[i+1]-a[i])>200)
				{
					ok=0;
					cout<<"IMPOSSIBLE\n";
					break;
				}
			if(ok)
				cout<<"POSSIBLE\n";
		}
	}
	return 0;
}

ty yeah i assumed there was a gas station in Delta Juntion but still wa astonished

#include<iostream>
using namespace std;
int main()
{
	int n,i,a[1423],ok,aux,l;
	while(cin>>n&&n)
	{	
		for(i=1;i<=n;i++)
			cin>>a[i];
		a[0]=0;
		l=n;
		do
		{
			ok=1;
			for(i=0;i<l-1;i++)
				if(a[i]>a[i+1])
				{
					ok=0;
					aux=a[i];
					a[i]=a[i+1];
					a[i+1]=aux;
				}
			l--;	
		}while(!ok);
		ok=1;
		if(1422-a[n]>100)
			cout<<"IMPOSSIBLE\n";
		else
		{
			for(i=0;i<n;i++)
				if((a[i+1]-a[i])>200)
				{
					ok=0;
					cout<<"IMPOSSIBLE\n";
					break;
				}
			if(ok)
				cout<<"POSSIBLE\n";
		}
	}
	return 0;
}

still wa

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,i,a[1423],ok,aux,l;
	while(cin>>n&&n)
	{	
		for(i=1;i<=n;i++)
			cin>>a[i];
		sort(a,a+n);
		ok=1;
		if(1422-a[n]>100)
			cout<<"IMPOSSIBLE\n";
		else
		{
			for(i=0;i<n;i++)
				if((a[i+1]-a[i])>200)
				{
					ok=0;
					cout<<"IMPOSSIBLE\n";
					break;
				}
			if(ok)
				cout<<"POSSIBLE\n";
		}
	}
	return 0;
}

fml still wa
srry for wasting so much of ur time frowning

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 17 10d

Want to read more? Browse other topics in C and C++ or view latest topics.