Const n=5;m=10; var b:array[1..n,1..m]of integer; i,j,k,buf,l:integer; begin for i:=1 to n do begin writeln; for j:=1 to m do begin b[i,j]:=random(50); write(b[i,j]:4); end; end; writeln; for j:=1 to m do begin k:=0; for i:=1 to n-1 do if b[i,j]<b[i+1,j]then k:=k+1; if k=n-1 then buf:=buf+1; end; k:=0; for l:=2 to m do if l mod 2=0 then for i:=1 to n-1 do for j:=i+1 to n do if b[i,l]>b[j,l]then begin k:=b[i,l]; b[i,l]:=b[j,l]; b[j,l]:=k; end; writeln('увеличилось ',m div 2-buf); for i:=1 to n do begin writeln; for j:=1 to m do write(b[i,j]:4); end; end.
// F# // 1. [<EntryPoint>] let main argv = let mutable x = System.Console.ReadLine() |> System.Double.Parse if x > 0.0 then x <- x+5.0 printf "%f" x System.Console.ReadKey true |> ignore 0 // 2. // F# [<EntryPoint>] let main argv = let mutable x = System.Console.ReadLine() |> System.Double.Parse let mutable y = System.Console.ReadLine() |> System.Double.Parse if x > y then x <- x*4.0; y <- y+4.0; else y <- y*4.0; x <- x+4.0; printf "x: %f\ny: %f" x y System.Console.ReadKey true |> ignore 0
n=5;m=10;
var
b:array[1..n,1..m]of integer;
i,j,k,buf,l:integer;
begin
for i:=1 to n do
begin
writeln;
for j:=1 to m do
begin
b[i,j]:=random(50);
write(b[i,j]:4);
end;
end;
writeln;
for j:=1 to m do
begin
k:=0;
for i:=1 to n-1 do
if b[i,j]<b[i+1,j]then
k:=k+1;
if k=n-1 then
buf:=buf+1;
end;
k:=0;
for l:=2 to m do
if l mod 2=0 then
for i:=1 to n-1 do
for j:=i+1 to n do
if b[i,l]>b[j,l]then
begin
k:=b[i,l];
b[i,l]:=b[j,l];
b[j,l]:=k;
end;
writeln('увеличилось ',m div 2-buf);
for i:=1 to n do
begin
writeln;
for j:=1 to m do
write(b[i,j]:4);
end;
end.
// 1.
[<EntryPoint>]
let main argv =
let mutable x = System.Console.ReadLine() |> System.Double.Parse
if x > 0.0
then x <- x+5.0
printf "%f" x
System.Console.ReadKey true |> ignore
0
// 2.
// F#
[<EntryPoint>]
let main argv =
let mutable x = System.Console.ReadLine() |> System.Double.Parse
let mutable y = System.Console.ReadLine() |> System.Double.Parse
if x > y
then x <- x*4.0; y <- y+4.0;
else y <- y*4.0; x <- x+4.0;
printf "x: %f\ny: %f" x y
System.Console.ReadKey true |> ignore
0