Cod sursa(job #1709130)

Utilizator CBOSTorinoUPB Andrei Bercaru CBOSTorino Data 28 mai 2016 11:00:15
Problema Carte2 Scor 100
Compilator cpp Status done
Runda ONIS 2016 - Runda - 2 - ACM ICPC Romanian Programming Contest Marime 0.79 kb
#include <iostream>
#include <fstream>

int main()
{
    std::ifstream f("carte2.in");
    std::ofstream g("carte2.out");

    int A, B, C, D, E, T;

    f >> T;

    for (int i = 0; i < T; i++) {
        f >> A >> B >> C >> D >> E;
        bool possible = false;

        // checking face C x D
        if ((A < C && B < D) || (A < D && B < C))
            possible = true;

        // checking face D x E
        if ((A < D && B < E) || (A < E && B < D))
            possible = true;

        // checking face C x E
        if ((A < C && B < E) || (A < E && B < C))
            possible = true;

        if(possible)
            g << "posibil" << std::endl;
        else
            g << "imposibil" << std::endl;
    }

    f.close();
    g.close();

    return 0;
}