Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 74c601d commit 00a677bCopy full SHA for 00a677b
2018/03_1/ruby/leovano.rb
@@ -0,0 +1,26 @@
1
+# frozen_string_literal: true
2
+
3
+begin
4
+ input = File.readlines(ARGV[0])
5
+rescue TypeError
6
+ STDERR.puts 'Arg1'
7
+ exit
8
+end
9
10
+claims = Hash.new 0
11
12
+input.map! do |claim|
13
+ claim.split(/[#@,:x]/)
14
+ .reject(&:empty?)
15
+ .map(&:to_i)
16
17
18
+input.each do |claim|
19
+ (claim[1]...claim[1] + claim[3]).each do |x|
20
+ (claim[2]...claim[2] + claim[4]).each do |y|
21
+ claims[[x, y]] += 1
22
+ end
23
24
25
26
+puts claims.values.count { |v| v > 1 }
0 commit comments