Guest User

Untitled

a guest
Aug 4th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.21 KB | None | 0 0
  1. a = "0" * 100
  2. a = a.split("").map(&:to_i)
  3. 2.times do |i|
  4.   a.each_with_index do |n, index|
  5.     a[index] = if (index + 1) % (i + 1) == 0
  6.       1 - n
  7.     else
  8.       n
  9.     end
  10.   end
  11. end
  12. puts a.inspect
Advertisement
Add Comment
Please, Sign In to add comment