Var a,b,c,d,e,x: integer; BEGIN readln(a,b,c,d,e); if {1} a>b then begin x:=a; a:=b; b:=x; end; if {2} c>d then begin x:=c; c:=d; d:=x; end; if {3} a>c then begin x:=a; a:=c; c:=x; x:=b; b:=d; d:=x; end; if {4} c>e then if {5} b>c then if {6} b>d then if {7} a>e then begin x:=e; e:=b; b:=a; a:=x; end else begin x:=e; e:=b; b:=x; end else if {7} a>e then begin x:=e; e:=d; d:=b; b:=a; a:=x; end else begin x:=e; e:=d; d:=b; b:=x; end else if {6} a>e then begin x:=e; e:=d; d:=c; c:=b; b:=a; a:=x; end else if {7} b>e then begin x:=e; e:=d; d:=c; c:=b; b:=x; end else begin x:=e; e:=d; d:=c; c:=x; end else if {5} d>e then if {6} b>e then if {7} b>d then begin x:=e; e:=b; b:=c; c:=x; end else begin x:=e; e:=d; d:=b; b:=c; c:=x; end else if {7} b>c then begin x:=b; b:=c; c:=x; x:=e; e:=d; d:=x; end else begin x:=e; e:=d; d:=x; end else if {6} b>d then if {7} b>e then begin x:=b; b:=c; c:=d; d:=e; e:=x; end else begin x:=b; b:=c; c:=d; d:=x; end else if {7} b>c then begin x:=b; b:=c; c:=x; end; writeln; writeln(a,' ',b,' ',c,' ',d,' ',e); END.
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream read_file("input.txt");
ofstream write_file("output.txt");
int x, y;
read_file >> x >> y;
if (x == 1 && y == 1) { write_file << "0" << endl; return 0; }
if (x == 1 || y == 1) { write_file << "1" << endl; return 0; }
if (x!=y) { write_file << "1" << endl; return 0; }
if (x == y) { write_file << "2" << endl; return 0; }
return 0;
}
BEGIN
readln(a,b,c,d,e);
if {1} a>b then begin x:=a; a:=b; b:=x; end;
if {2} c>d then begin x:=c; c:=d; d:=x; end;
if {3} a>c then begin x:=a; a:=c; c:=x; x:=b; b:=d; d:=x; end;
if {4} c>e then
if {5} b>c then
if {6} b>d then
if {7} a>e then begin x:=e; e:=b; b:=a; a:=x; end
else begin x:=e; e:=b; b:=x; end
else
if {7} a>e then begin x:=e; e:=d; d:=b; b:=a; a:=x; end
else begin x:=e; e:=d; d:=b; b:=x; end
else
if {6} a>e then begin x:=e; e:=d; d:=c; c:=b; b:=a; a:=x; end
else
if {7} b>e then begin x:=e; e:=d; d:=c; c:=b; b:=x; end
else begin x:=e; e:=d; d:=c; c:=x; end
else
if {5} d>e then
if {6} b>e then
if {7} b>d then begin x:=e; e:=b; b:=c; c:=x; end
else begin x:=e; e:=d; d:=b; b:=c; c:=x; end
else
if {7} b>c then begin x:=b; b:=c; c:=x; x:=e; e:=d; d:=x; end
else begin x:=e; e:=d; d:=x; end
else
if {6} b>d then
if {7} b>e then begin x:=b; b:=c; c:=d; d:=e; e:=x; end
else begin x:=b; b:=c; c:=d; d:=x; end
else
if {7} b>c then begin x:=b; b:=c; c:=x; end;
writeln;
writeln(a,' ',b,' ',c,' ',d,' ',e);
END.