Pagini recente » Cod sursa (job #1948146) | Cod sursa (job #647715) | Cod sursa (job #1994321) | Cod sursa (job #3239281) | Cod sursa (job #1711211)
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner reader = new Scanner(new FileInputStream("carte2.in"));
PrintWriter writer = new PrintWriter("carte2.out");
int n = reader.nextInt();
for (int i = 1; i <= n; i++) {
int a = reader.nextInt();
int b = reader.nextInt();
int c = reader.nextInt();
int d = reader.nextInt();
int e = reader.nextInt();
int[] dimBook = { a, b };
Arrays.sort(dimBook);
int[] dimBox = { c, d, e };
Arrays.sort(dimBox);
int pos1 = -1;
if (dimBox[0] > dimBook[0]) {
pos1 = 0;
} else if (dimBox[1] > dimBook[0]) {
pos1 = 1;
} else if (dimBox[2] > dimBook[0]) {
pos1 = 2;
}
if (pos1 == 2 || pos1 == -1) {
writer.append("imposibil\n");
} else {
if (pos1 == 0) {
if (dimBox[1] > dimBook[1] || dimBox[2] > dimBook[1]) {
writer.append("posibil\n");
} else {
writer.append("imposibil\n");
}
} else if (pos1 == 1) {
if (dimBox[2] > dimBook[1]) {
writer.append("posibil\n");
} else {
writer.append("imposibil\n");
}
}
}
}
writer.close();
reader.close();
}
}