Skip to content

Instantly share code, notes, and snippets.

@parrot-studio parrot-studio/enshura
Last active Aug 29, 2015

Embed
What would you like to do?
https://paiza.jp/poh/enshura
puts gets.chars.each.with_index.select{|c, i| i.even?}.map(&:first).join
rsl = [0,0,0,0,0,0,0]
gets.to_i.times do |i|
break unless str = gets
rsl[i % 7] += str.to_i
end
puts rsl.join("\n")
w, h = gets.split(' ').map(&:to_i)
counts = Hash.new(0)
h.times do
nums = gets.split(' ').map(&:to_i)
nums.each.with_index(1) do |n, i|
next unless n == 1
counts[i] += 1
end
end
h.times do |i|
list = []
(1..w).each do |x|
list << (counts[x] >= (h-i) ? 1 : 0)
end
puts list.join(' ')
end
w, h, n = gets.split(' ').map(&:to_i)
table = []
h.times do
gets.split(' ').map(&:to_i).each{|n| table << n}
end
all = 0
n.times do
sx, sy, ex, ey = gets.split(' ').map(&:to_i)
(sy..ey).each do |y|
break if y > h
(sx..ex).each do |x|
break if x > w
ind = w * (y-1) + (x-1)
all += table[ind]
table[ind] = 0
end
end
end
puts all
@parrot-studio

This comment has been minimized.

Copy link
Owner Author

commented Apr 15, 2015

@parrot-studio

This comment has been minimized.

Copy link
Owner Author

commented Apr 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.