import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb = new StringBuffer("");
while(true){
int n=Integer.parseInt(br.readLine());
if(n==0)
break;
int []arr=new int[n];
for(int i=0;i<n;i++){
arr[i]=Integer.parseInt(br.readLine());
}
Arrays.sort(arr);
boolean possible=true;
if(arr[0]>200){
possible=false;
}
else if(2*(1422-arr[n-1])>200){
possible=false;
}
else{
for(int i=0;i<arr.length-1;i++){
if(arr[i+1]-arr[i]>200){
possible=false;
break;
}
}
}
if(possible){
sb.append("POSSIBLE").append("\n");
}else{
sb.append("IMPOSSIBLE").append("\n");
}
}
System.out.print(sb);
}
}
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb = new StringBuffer("");
while(true){
int n=Integer.parseInt(br.readLine());
if(n==0)
break;
int []arr=new int[n];
for(int i=0;i<n;i++){
arr[i]=Integer.parseInt(br.readLine());
}
Arrays.sort(arr);
boolean possible=true;
if(arr[0]>200){
possible=false;
}
else if(2*(1422-arr[n-1])>200){
possible=false;
}
else{
for(int i=0;i<arr.length-1;i++){
if(arr[i+1]-arr[i]>200){
possible=false;
break;
}
}
}
if(possible){
sb.append("POSSIBLE").append("\n");
}else{
sb.append("IMPOSSIBLE").append("\n");
}
}
System.out.print(sb);
}
}
No comments:
Post a Comment