Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #1
- puts gets.chomp.split(//).each_with_index.select{|c,i| i.even?}.map{|c| c[0]}.join
- #2
- out = Array.new(7,0)
- puts gets.to_i.times.map{|i| out[i%7] += gets.to_i}[-7..-1]
- #MINAMI
- x, y = gets.split.map(&:to_i)
- y.times.map{gets.split.map(&:to_i)}.transpose.map{|r| [1] * r.count(1) + [0] * (y - r.count(1))}.transpose.reverse.map{|r| puts r * " "}
- #RENA
- x, y, N = gets.split.map(&:to_i)
- t = y.times.map{gets.split.map(&:to_i)}
- s = N.times.map{gets.split.map(&:to_i)}
- ans = 0
- t.each.with_index(1) do |r,i|
- r.each.with_index(1) do |c,j|
- s.each do |xs,ys,xe,ye|
- if i.between?(ys,ye) && j.between?(xs,xe)
- ans += c
- break
- end
- end
- end
- end
- p ans
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement