import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
//Scanner sc =new Scanner(System.in);
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
//StringBuilder sb = new StringBuilder();
StringBuffer sbr = new StringBuffer("");
String m = "";
//boolean flag=true;
int tc = Integer.parseInt(br.readLine());
while(tc!=0)
{
boolean possible = true;
//int tc = Integer.parseInt(br.readLine());
int [] stations = new int[tc];
for (int i = 0; i< tc; i++) {
stations[i]= Integer.parseInt(br.readLine());
}
Arrays.sort(stations);
if (tc<7) possible = false;
else{
if (stations[0] > 200) possible = false;
else if ( 1422 - stations[tc-1] > 100) possible = false;
else {
int tmp = stations[0];
for (int idx2 =1; idx2<tc; idx2++) {
if (stations[idx2] - tmp > 200) possible = false;
else {
tmp = stations[idx2];
}
}
}
}
if (!possible) sbr.append("IMPOSSIBLE" + "\n");
else {
sbr.append("POSSIBLE\n");
}
tc = Integer.parseInt(br.readLine());
}
System.out.print(sbr);
}
}
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
//Scanner sc =new Scanner(System.in);
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
//StringBuilder sb = new StringBuilder();
StringBuffer sbr = new StringBuffer("");
String m = "";
//boolean flag=true;
int tc = Integer.parseInt(br.readLine());
while(tc!=0)
{
boolean possible = true;
//int tc = Integer.parseInt(br.readLine());
int [] stations = new int[tc];
for (int i = 0; i< tc; i++) {
stations[i]= Integer.parseInt(br.readLine());
}
Arrays.sort(stations);
if (tc<7) possible = false;
else{
if (stations[0] > 200) possible = false;
else if ( 1422 - stations[tc-1] > 100) possible = false;
else {
int tmp = stations[0];
for (int idx2 =1; idx2<tc; idx2++) {
if (stations[idx2] - tmp > 200) possible = false;
else {
tmp = stations[idx2];
}
}
}
}
if (!possible) sbr.append("IMPOSSIBLE" + "\n");
else {
sbr.append("POSSIBLE\n");
}
tc = Integer.parseInt(br.readLine());
}
System.out.print(sbr);
}
}
No comments :
Post a Comment