Skip to content

Instantly share code, notes, and snippets.

@parrot-studio
Last active August 29, 2015 14:19
Show Gist options
  • Save parrot-studio/fe12bfe45208a07dca1b to your computer and use it in GitHub Desktop.
Save parrot-studio/fe12bfe45208a07dca1b to your computer and use it in GitHub Desktop.
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
Copy link
Author

@parrot-studio
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment