Advertisement
Queuebee

First codingame clash in ruby -- need feedback

Sep 13th, 2020 (edited)
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.27 KB | None | 0 0
  1. # this code should take a candy-amount C and mouth-size M
  2. # then print the quickest way to eat all the candies
  3. # so if 10 candies, mouthsize 3, the output should be 3 3 3 1
  4.  
  5. C,M=gets.split(" ").collect {|x| x.to_i}
  6. while C>M
  7.  print "%d " % [M]
  8.  C=C-M
  9.  end
  10. print C
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement