Cod sursa(job #2494309)

Utilizator SochuDarabaneanu Liviu Eugen Sochu Data 17 noiembrie 2019 17:37:07
Problema Carte2 Scor 100
Compilator cpp-64 Status done
Runda Arhiva ICPC Marime 1.62 kb
#include <bits/stdc++.h>

using namespace std;

ifstream f ("carte2.in");
ofstream g ("carte2.out");

short t , a , b , c , d , e;

void Test(short a , short b , short c , short d , short e)
{
    /// first case: c x d x e
    if(a < c && b < d)
    {
        g << "posibil" << '\n';
        return;
    }

    if(b < c && a < d)
    {
        g << "posibil" << '\n';
        return;
    }

    ///second case: c x e x d
    if(a < c && b < e)
    {
        g << "posibil" << '\n';
        return;
    }

    if(b < c && a < e)
    {
        g << "posibil" << '\n';
        return;
    }

    ///third case: d x c x e
    if(a < d && b < c)
    {
        g << "posibil" << '\n';
        return;
    }

    if(b < d && a < c)
    {
        g << "posibil" << '\n';
        return;
    }

    ///fourth case: d x e x c
    if(a < d && b < e)
    {
        g << "posibil" << '\n';
        return;
    }

    if(b < d && a < e)
    {
        g << "posibil" << '\n';
        return;
    }

    ///fifth case: e x d x c
    if(a < e && b < d)
    {
        g << "posibil" << '\n';
        return;
    }

    if(b < e && a < d)
    {
        g << "posibil" << '\n';
        return;
    }

    ///sixth case: e x c x d
    if(a < e && b < c)
    {
        g << "posibil" << '\n';
        return;
    }

    if(b < e && a < c)
    {
        g << "posibil" << '\n';
        return;
    }

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

int main()
{
    f >> t;

    while(t--)
    {
        f >> a >> b >> c >> d >> e;
        Test(a , b , c , d , e);
    }

    return 0;
}