Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- N, TempN: Integer;
- IsTwo, IsFinal: Boolean;
- Answer: string;
- begin
- Readln(N);
- TempN := N;
- IsTwo := True;
- IsFinal := False;
- while not IsFinal do
- begin
- while N > 0 do
- begin
- N := N - 1 - ord(IsTwo);
- Answer := Answer + chr(1 + ord(IsTwo) + 48);
- IsTwo := not IsTwo;
- end;
- if N < 0 then
- begin
- Answer := '';
- IsTwo := False;
- N := TempN;
- end
- else
- begin
- write(Answer);
- IsFinal := True;
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement