1)function first(k,l,m,n:integer):boolean; begin if (((k mod 2=0) and (l mod 2<>0)) or ((l mod 2=0) and (k mod 2<>0)))=(((m mod 2=0) and (n mod 2<>0)) or ((n mod 2=0) and (m mod 2<>0))) then first:=true else first:=false; end;
2)function second(k,l,m,n:integer):boolean; begin if (k=m) or (l=n) or (((k+1)=m) and ((l+1)=n)) or (((k+2)=m) and ((l+2)=n)) or (((k+3)=m) and ((l+3)=n)) or (((k+4)=m) and ((l+4)=n)) or (((k+5)=m) and ((l+5)=n)) or (((k+6)=m) and ((l+6)=n)) or (((k-1)=m) and ((l-1)=n)) or (((k-2)=m) and ((l-2)=n)) or (((k-3)=m) and ((l-3)=n)) or (((k-4)=m) and ((l-4)=n)) or (((k-5)=m) and ((l-5)=n)) or (((k-6)=m) and ((l-6)=n)) or (((m+1)=k) and ((n+1)=l)) or (((m+2)=k) and ((n+2)=l)) or (((m+3)=k) and ((n+3)=l)) or (((m+4)=k) and ((n+4)=l)) or (((m+5)=k) and ((n+5)=l)) or (((m+6)=k) and ((n+6)=l)) or (((m-1)=k) and ((n-1)=l)) or (((m-2)=k) and ((n-2)=l)) or (((m-3)=k) and ((n-3)=l)) or (((m-4)=k) and ((n-4)=l)) or (((m-5)=k) and ((n-5)=l)) or (((m-6)=k) and ((n-6)=l)) or (((k-1)=m) and ((l+1)=n)) or (((k-2)=m) and ((l+2)=n)) or (((k-3)=m) and ((l+3)=n)) or (((k-4)=m) and ((l+4)=n)) or (((k-5)=m) and ((l+5)=n)) or (((k-6)=m) and ((l+6)=n)) or (((k-1)=m) and ((l+1)=n)) or (((k-2)=m) and ((l+2)=n)) or (((k-3)=m) and ((l+3)=n)) or (((k-4)=m) and ((l+4)=n)) or (((k-5)=m) and ((l+5)=n)) or (((k-6)=m) and ((l+6)=n)) or (((m-1)=k) and ((n+1)=l)) or (((m-2)=k) and ((n+2)=l)) or (((m-3)=k) and ((n+3)=l)) or (((m-4)=k) and ((n+4)=l)) or (((m-5)=k) and ((n+5)=l)) or (((m-6)=k) and ((n+6)=l)) or (((m-1)=k) and ((n+1)=l)) or (((m-2)=k) and ((n+2)=l)) or (((m-3)=k) and ((n+3)=l)) or (((m-4)=k) and ((n+4)=l)) or (((m-5)=k) and ((n+5)=l)) or (((m-6)=k) and ((n+6)=l)) then second:=true else second:=false; end;
дешифровки: Const sh = '_.,'; Var St : String; i : Integer; Function DeCode(S : String; Tabl : String; k : Integer) : String; Var j,n : Integer; Begin For j:=1 to Length(S) do Begin n:=Pos(S[j],sh); If n>0 then Begin n:=n+k; While n>Length(sh) do n:=n-Length(sh); While n<=0 do n:=n+Length(sh); S[j]:=sh[n]; end end; DeCode:=S; end; Begin St:='ЗЫФЙГФШРЦ . ШД'; Writeln(Decode(St,sh,-6)); //For i:=-10 to 10 do Writeln(Decode(St,sh,i)); end.
begin
if (((k mod 2=0) and (l mod 2<>0)) or ((l mod 2=0) and (k mod 2<>0)))=(((m mod 2=0) and (n mod 2<>0)) or ((n mod 2=0) and (m mod 2<>0))) then first:=true else first:=false;
end;
2)function second(k,l,m,n:integer):boolean;
begin
if (k=m) or (l=n) or (((k+1)=m) and ((l+1)=n)) or (((k+2)=m) and ((l+2)=n)) or (((k+3)=m) and ((l+3)=n)) or (((k+4)=m) and ((l+4)=n)) or (((k+5)=m) and ((l+5)=n)) or (((k+6)=m) and ((l+6)=n)) or (((k-1)=m) and ((l-1)=n)) or (((k-2)=m) and ((l-2)=n)) or (((k-3)=m) and ((l-3)=n)) or (((k-4)=m) and ((l-4)=n)) or (((k-5)=m) and ((l-5)=n)) or (((k-6)=m) and ((l-6)=n)) or (((m+1)=k) and ((n+1)=l)) or (((m+2)=k) and ((n+2)=l)) or (((m+3)=k) and ((n+3)=l)) or (((m+4)=k) and ((n+4)=l)) or (((m+5)=k) and ((n+5)=l)) or (((m+6)=k) and ((n+6)=l)) or (((m-1)=k) and ((n-1)=l)) or (((m-2)=k) and ((n-2)=l)) or (((m-3)=k) and ((n-3)=l)) or (((m-4)=k) and ((n-4)=l)) or (((m-5)=k) and ((n-5)=l)) or (((m-6)=k) and ((n-6)=l)) or (((k-1)=m) and ((l+1)=n)) or (((k-2)=m) and ((l+2)=n)) or (((k-3)=m) and ((l+3)=n)) or (((k-4)=m) and ((l+4)=n)) or (((k-5)=m) and ((l+5)=n)) or (((k-6)=m) and ((l+6)=n)) or (((k-1)=m) and ((l+1)=n)) or (((k-2)=m) and ((l+2)=n)) or (((k-3)=m) and ((l+3)=n)) or (((k-4)=m) and ((l+4)=n)) or (((k-5)=m) and ((l+5)=n)) or (((k-6)=m) and ((l+6)=n)) or (((m-1)=k) and ((n+1)=l)) or (((m-2)=k) and ((n+2)=l)) or (((m-3)=k) and ((n+3)=l)) or (((m-4)=k) and ((n+4)=l)) or (((m-5)=k) and ((n+5)=l)) or (((m-6)=k) and ((n+6)=l)) or (((m-1)=k) and ((n+1)=l)) or (((m-2)=k) and ((n+2)=l)) or (((m-3)=k) and ((n+3)=l)) or (((m-4)=k) and ((n+4)=l)) or (((m-5)=k) and ((n+5)=l)) or (((m-6)=k) and ((n+6)=l)) then second:=true else second:=false;
end;
дешифровки:
Const sh = '_.,';
Var
St : String;
i : Integer;
Function DeCode(S : String; Tabl : String; k : Integer) : String;
Var j,n : Integer;
Begin
For j:=1 to Length(S) do
Begin
n:=Pos(S[j],sh);
If n>0 then
Begin
n:=n+k;
While n>Length(sh) do n:=n-Length(sh);
While n<=0 do n:=n+Length(sh);
S[j]:=sh[n];
end
end;
DeCode:=S;
end;
Begin
St:='ЗЫФЙГФШРЦ . ШД';
Writeln(Decode(St,sh,-6));
//For i:=-10 to 10 do Writeln(Decode(St,sh,i));
end.