Advertisement
Guest User

Untitled

a guest
May 24th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #1
  2. puts gets.chomp.split(//).each_with_index.select{|c,i| i.even?}.map{|c| c[0]}.join
  3.  
  4. #2
  5. out = Array.new(7,0)
  6. puts gets.to_i.times.map{|i| out[i%7] += gets.to_i}[-7..-1]
  7.  
  8. #MINAMI
  9. x, y = gets.split.map(&:to_i)
  10. 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 * " "}
  11.  
  12. #RENA
  13. x, y, N = gets.split.map(&:to_i)
  14. t = y.times.map{gets.split.map(&:to_i)}
  15. s = N.times.map{gets.split.map(&:to_i)}
  16. ans = 0
  17. t.each.with_index(1) do |r,i|
  18. r.each.with_index(1) do |c,j|
  19. s.each do |xs,ys,xe,ye|
  20. if i.between?(ys,ye) && j.between?(xs,xe)
  21. ans += c
  22. break
  23. end
  24. end
  25. end
  26. end
  27. p ans
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement