Advertisement
MonsterScripter

CodinGame_2023_09_14__16_17_48__team_set.rb

Sep 14th, 2023
1,165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.23 KB | None | 0 0
  1. allKids = gets.chomp
  2. numOfTeams = gets.to_i
  3. kids = allKids.split(', ')
  4.  
  5. numOfTeams.times do |i|
  6.   r = "Team #{i + 1}: "
  7.   (i...kids.length).step(numOfTeams) do |j|
  8.     r += "#{kids[j]}, "
  9.   end
  10.   r = r[0...-2]
  11.   puts r
  12. end
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement