Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.79 KB | None | 0 0
  1. program DM;
  2. {$APPTYPE CONSOLE}
  3. uses
  4.   SysUtils;
  5. var
  6.     Arr: array of Integer;
  7.     TempArr: array of Integer;
  8.     Input, Output: string;
  9.     i, j : Integer;
  10. begin
  11.     Read(Input);
  12.     Output := '';
  13.     SetLength(Arr, Length(Input));
  14.     SetLength(TempArr, Length(Input) - 1);
  15.     for i := 0 to Length(Input) - 1 do
  16.         Arr[i] := StrToInt(Input[i + 1]);
  17.     for i := 0 to Length(Input) - 2 do
  18.     begin
  19.         Output := Output + IntToStr(Arr[0]);
  20.         for j := 0 to Length(Arr) - 2 do
  21.             TempArr[j] := Arr[j] xor Arr[j + 1];
  22.         SetLength(Arr, Length(TempArr));
  23.         for j := 0 to Length(TempArr) - 1 do
  24.             Arr[j] := TempArr[j];
  25.         SetLength(TempArr, Length(TempArr) - 1);
  26.     end;
  27.     Output := Output + IntToStr(Arr[0]);
  28.     Write(Output);
  29. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement