You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
269 B
11 lines
269 B
8 years ago
|
Node = Struct.new(*%i[x y size used avail use])
|
||
|
|
||
|
nodes = ARGF
|
||
|
.read
|
||
|
.scan(%r|/dev/grid/node-x(\d+)-y(\d+)\s+(\d+)T\s+(\d+)T\s+(\d+)T\s*(\d+)%|)
|
||
|
.map {|match| Node.new(*match.map(&:to_i)) }
|
||
|
|
||
|
p nodes.permutation(2).count {|a,b|
|
||
|
a.used != 0 && a.used <= b.avail
|
||
|
}
|