Cod sursa(job #1708967)

Utilizator UAIC_TheFormerOneUAIC TheFormerOne UAIC_TheFormerOne Data 28 mai 2016 10:24:32
Problema Carte2 Scor 100
Compilator cpp Status done
Runda ONIS 2016 - Runda - 2 - ACM ICPC Romanian Programming Contest Marime 0.68 kb
#include <iostream>
#include <fstream>
using namespace std;

int main(){
	ifstream in("carte2.in");
	ofstream out("carte2.out");

	int t, a, b, c, d, e;
	int max = 0,max2=0;
	in >> t;
	while (t--){
		max = 0; max2 = 0;
		in >> a >> b >> c>>d>>e;
		max = c;
		if (d > c){
			max = d;
			max2 = c;
		}
		else max2 = d;
		if (e > max2){
			if (e > max){
				max2 = max;
				max = e;
			}
			else{
				max2 = e;
			}
		}
		if (a > b){
			if (a < max && b < max2){
				out << "posibil\n";
			}
			else{
				out << "imposibil\n";
			}
		}
		else{
			if (a < max2 && b < max){
				out << "posibil\n";
			}
			else{
				out << "imposibil\n";
			}
		}
	}
}