Advertisement
Guest User

Problem C

a guest
Mar 18th, 2012
511
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. USING: io kernel math math.parser strings sequences locals ascii ;
  2.  
  3. IN: template
  4.  
  5. :: test ( out d n -- a b c )
  6.  
  7. n 1 =
  8. [ out d n ]
  9. [
  10. n
  11. d
  12. mod 0 =
  13. [
  14. out
  15. length
  16. 0 =
  17. [ d number>string ]
  18. [ out "*" append d number>string append ]
  19. if
  20.  
  21. d
  22. n d /
  23. ]
  24. [ out d 1 + n ]
  25. if
  26.  
  27. test
  28.  
  29. ]
  30. if ;
  31.  
  32.  
  33.  
  34.  
  35. ""
  36. 2
  37. readln string>number
  38. test
  39.  
  40. drop
  41. drop
  42.  
  43. print
Advertisement
RAW Paste Data Copied
Advertisement