дешифровки: 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.
#генерируем список из 2000 элементов my_list = [(lambda x:(x*296+2410)%4096)(i) for i in range(2000)]
# начальное значение для временного минимума min1_value = min2_value = 10000 min1_number = min2_number = 0
while my_list: x = my_list.pop() if x < min1_value: min2_value = min1_value min2_number = min1_number min1_value = x min1_number = 1 elif x == min1_value: min1_number += 1 elif x < min2_value: min2_value = x min2_number = 1 elif x == min2_value: min2_number += 1
дешифровки:
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.
my_list = [(lambda x:(x*296+2410)%4096)(i) for i in range(2000)]
# начальное значение для временного минимума
min1_value = min2_value = 10000
min1_number = min2_number = 0
while my_list:
x = my_list.pop()
if x < min1_value:
min2_value = min1_value
min2_number = min1_number
min1_value = x
min1_number = 1
elif x == min1_value:
min1_number += 1
elif x < min2_value:
min2_value = x
min2_number = 1
elif x == min2_value:
min2_number += 1
print(min2_number)