day 1 cannot mawk but it can gawk
This commit is contained in:
parent
7cae50b408
commit
cf7806ca01
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
l[NR] = $1
|
||||
r[NR] = $2
|
||||
C[$2]++
|
||||
}
|
||||
|
||||
END {
|
||||
asort(l)
|
||||
asort(r)
|
||||
for (i = 1; i <= NR; i++) {
|
||||
d = l[i] - r[i]
|
||||
D1 += (d < 0) ? -d : d
|
||||
D2 += l[i] * C[l[i]]
|
||||
}
|
||||
print D1, D2
|
||||
}
|
Loading…
Reference in New Issue