Advertisement
Racknoss

Расшифровщик и Дешифровщик

May 8th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 2.08 KB | None | 0 0
  1. var
  2. a, b,  c, g:Integer;
  3. i:Char;
  4. fix, h:int64;
  5. s:string;
  6. label 1, 2;
  7. Begin;
  8. 2:Readln(s);
  9. s:=Lowercase(s);
  10. s:=ReverseString(s);
  11. for c:= 1 to Length(s) do
  12.  begin
  13.  b:=ordUnicode(s[c])-1071;
  14.  h:=1;
  15.  for g:= 1 to c do
  16.  begin
  17.  h:=h*33;
  18.  end;
  19.  h:=h div 33;
  20.  fix:=fix+(h*b);
  21.  end;
  22. writeln(fix);
  23. writeln('Еще одно слово?');
  24. readln(c);
  25. if c=1 then goto 2;
  26. end.
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. var
  35. a, c, g:Integer;
  36. fix, h, f:Int64;
  37. label 1;
  38. Begin
  39. 1:writeln;
  40. readln(fix);
  41. if fix>33 then c:=2;
  42. if fix>1122 then c:=3;
  43. if fix>37059 then c:=4;
  44. if fix>1222980 then c:=5;
  45. if fix>40358373 then c:=6;
  46. if fix>1331836342 then c:=7;
  47. if fix>43950269319 then c:=8;
  48. if fix>1450358887560 then c:=9;
  49. if fix>47861843289513 then c:=10;
  50. if fix>1579440828553962 then c:=11;
  51. if fix>52121547342280779 then c:=12;
  52. if fix>1720011062295265740 then c:=13;
  53. if fix>1420132834615114605 then writeln('Перебор');
  54. for a:= 0 to (c-1) do
  55.  begin
  56.  h:=1;
  57.   for g:= 1 to (c-a) do
  58.   begin
  59.    h:=h*33;
  60.   end;
  61.  g:=0;
  62.   repeat
  63.   g:=g+1;
  64.   f:=g*(h div 33);
  65.   until(fix-f<(h div 33));
  66.  if g=1 then write('а');
  67.  if g=2 then write('б');
  68.  if g=3 then write('в');
  69.  if g=4 then write('г');
  70.  if g=5 then write('д');
  71.  if g=6 then write('е');
  72.  if g=7 then write('ж');
  73.  if g=8 then write('з');
  74.  if g=9 then write('и');
  75.  if g=10 then write('й');
  76.  if g=11 then write('к');
  77.  if g=12 then write('л');
  78.  if g=13 then write('м');
  79.  if g=14 then write('н');
  80.  if g=15 then write('о');
  81.  if g=16 then write('п');
  82.  if g=17 then write('р');
  83.  if g=18 then write('с');
  84.  if g=19 then write('т');
  85.  if g=20 then write('у');
  86.  if g=21 then write('ф');
  87.  if g=22 then write('х');
  88.  if g=23 then write('ц');
  89.  if g=24 then write('ч');
  90.  if g=25 then write('ш');
  91.  if g=26 then write('щ');
  92.  if g=27 then write('ъ');
  93.  if g=28 then write('ы');
  94.  if g=29 then write('ь');
  95.  if g=30 then write('э');
  96.  if g=31 then write('ю');
  97.  if g=32 then write('я');
  98.  if g=33 then write('ё');
  99.  fix:=fix-g*(h div 33);
  100.  end;
  101.  writeln;
  102. writeln('Еще одно слово?');
  103. read(fix);
  104. if fix = 1 then goto 1;
  105. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement