giabinh

BCSINH_SinhDayNhiPhanCoDoDaiNLMH

Jun 18th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. const fi='BCSINH.inp';
  2. fo='BCSINH.out';
  3.  
  4. var n, i: longint;
  5. x: array [1..30] of longint;
  6.  
  7. begin
  8. assign(input, fi); reset(input);
  9. assign(output, fo); rewrite(output);
  10.  
  11. readln(n);
  12.  
  13. fillchar(x, sizeof(x), 0); i:=1;
  14. while i<>0 do
  15. begin
  16. for i:=1 to n do write(x[i]); writeln;
  17. i:=n;
  18. while (i>0) and (x[i]=1) do dec(i);
  19. if i>0 then
  20. begin
  21. x[i]:=1;
  22. fillchar(x[i+1], (n-i)*sizeof(x[1]), 0);
  23. end;
  24. end;
  25.  
  26. close(input); close(output);
  27. end.
Advertisement
Add Comment
Please, Sign In to add comment