class Program
{
static void Main(string[] args)
{
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int x = int.Parse(Console.ReadLine());
int y = int.Parse(Console.ReadLine());
int z = int.Parse(Console.ReadLine());
if (x <= a && y <= b || y <= a && x <= b ||
x <= a && z <= b || z <= a && x <= b ||
z <= a && y <= b || y <= a && z <= b)
Console.WriteLine("Пройдет");
else
Console.WriteLine("Не пройдет");
Console.ReadKey();
}
}
Объяснение:
.
Язык не указан → приведу пример на SWI-Prolog.
Код%Файл string_sortin.plsort([], [], _).sort([Head|Tail], Ordered, Qrd) :- sort(Tail, SubSorted, Qrd), put(Head, SubSorted, Sorted), order(Sorted, [], Ordered, Qrd).put(X, [], [X]).put(X, [H|T], [X,H|T]) :- compare(>, X, H).put(X, [H|T], [H|R]) :- put(X, T, R).order(X, _, X, ">").order([], R, R, "<").order([H|T], B, R, "<") :- order(T, [H|B], R, "<").select(">", Bufer, Bufer, _, ">").select("<", Bufer, Bufer, _, "<").select(S, Bufer, [S|Bufer], Ord, Ord).input_strings(Input, Bufer, Strings, Ord, ROrd) :- compare(=, Ord, "="), read_string(Input, "\n", "\r", _, String), select(String, Bufer, SS, Ord, OO), input_strings(Input, SS, Strings, OO, ROrd).input_strings(_, Strings, Strings, Ord, Ord). ?- current_input(Input), input_strings(Input, [], Strings, "=", Ord), sort(Strings, [R|_], Ord), writeln(R).