Advertisement
Guest User

Problem B

a guest
Mar 18th, 2012
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. USING: io kernel math math.parser strings sequences ;
  2.  
  3. IN: template
  4.  
  5. : test ( n str -- c d )
  6. dup 0 =
  7. [ ]
  8. [
  9. dup 2 mod
  10. 0 =
  11. [ swap "0" swap append swap ]
  12. [ swap "1" swap append swap ]
  13. if
  14. 2
  15. /i
  16.  
  17. test
  18. ]
  19. if ;
  20.  
  21.  
  22.  
  23. ""
  24. readln string>number
  25.  
  26. test
  27.  
  28. drop
  29. print
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement