Advertisement
Guest User

Problem E

a guest
Mar 18th, 2012
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. USING: io kernel math math.parser strings sequences locals ;
  2.  
  3. IN: template
  4.  
  5. :: test ( rtn cur -- a b )
  6.  
  7. cur "" =
  8. [ rtn cur ]
  9. [
  10. cur 1 tail
  11. cur 1 head
  12.  
  13. 0
  14. swap
  15.  
  16. dup "H" = [ swap 1 + swap ] [ ] if
  17. dup "Q" = [ swap 1 + swap ] [ ] if
  18. dup "9" = [ swap 1 + swap ] [ ] if
  19.  
  20. drop
  21. rtn
  22. +
  23. swap
  24. test
  25.  
  26. ]
  27. if ;
  28.  
  29.  
  30.  
  31. 0
  32. readln
  33. test
  34.  
  35. drop
  36.  
  37. 0 =
  38. [ "NO" ]
  39. [ "YES" ]
  40. if
  41.  
  42. print
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement