Cod sursa(job #1709358)

Utilizator UBB_RETIRED_BUT_DANGEROUSUBBTEAM UBB_RETIRED_BUT_DANGEROUS Data 28 mai 2016 11:55:34
Problema Carte2 Scor 100
Compilator cpp Status done
Runda ONIS 2016 - Runda - 2 - ACM ICPC Romanian Programming Contest Marime 0.81 kb
#include <fstream>

using namespace std;

ifstream fin("carte2.in");
ofstream fout("carte2.out");

bool fits(int boxX, int boxY, int bookX, int bookY)
{
	if (bookX < boxX && bookY < boxY)
	{
		return true;
	}

	if (bookX < boxY && bookY < boxX)
	{
		return true;
	}

	return false;
}

int main()
{
	int T; fin >> T;
	for (int t = 0; t < T; t++)
	{
		int A, B, C, D, E;
		fin >> A >> B >> C >> D >> E;

		// dimesion C x D of the box
		if (fits(C, D, A, B))
		{
			fout << "posibil" << '\n';
			continue;
		}

		// dimesion C x D of the box
		if (fits(D, E, A, B))
		{
			fout << "posibil" << '\n';
			continue;
		}

		// dimesion C x D of the box
		if (fits(E, C, A, B))
		{
			fout << "posibil" << '\n';
			continue;
		}

		fout << "imposibil" << '\n';
	}

	return 0;
}