Advertisement
Guest User

Problem F

a guest
Mar 18th, 2012
212
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 ( z n f -- a b c )
  6.  
  7. f 1 =
  8. [ z n f ]
  9. [
  10. z
  11. n f *
  12. dup 10 mod 0 = [ swap 1 + swap 10 / ] [ ] if
  13. dup 10 mod 0 = [ swap 1 + swap 10 / ] [ ] if
  14. dup 10 mod 0 = [ swap 1 + swap 10 / ] [ ] if
  15. dup 10 mod 0 = [ swap 1 + swap 10 / ] [ ] if
  16. dup 10 mod 0 = [ swap 1 + swap 10 / ] [ ] if
  17. dup 10 mod 0 = [ swap 1 + swap 10 / ] [ ] if
  18. dup 10 mod 0 = [ swap 1 + swap 10 / ] [ ] if
  19. dup 10 mod 0 = [ swap 1 + swap 10 / ] [ ] if
  20. dup 10 mod 0 = [ swap 1 + swap 10 / ] [ ] if
  21.  
  22. 1000000000 mod
  23. f
  24. 1
  25. -
  26. test
  27.  
  28. ]
  29. if ;
  30.  
  31.  
  32. 0
  33. 1
  34. readln string>number
  35. test
  36.  
  37. drop
  38. drop
  39.  
  40. number>string print
Advertisement
RAW Paste Data Copied
Advertisement