14_2 solves part 1 and 2
This commit is contained in:
parent
d39dc8b14b
commit
12cc89de34
20
14/14_2.awk
20
14/14_2.awk
|
@ -30,15 +30,15 @@ END{
|
|||
}
|
||||
delete paircount
|
||||
for(p in newpaircount) paircount[p] = newpaircount[p]
|
||||
}
|
||||
min = 999999999999
|
||||
max = 0
|
||||
for(c in countl){
|
||||
count[c] = countl[c]>countr[c] ? countl[c] : countr[c]
|
||||
if(count[c]>max) max=count[c]
|
||||
if(count[c]<min) min=count[c]
|
||||
}
|
||||
|
||||
print max, min
|
||||
print max-min
|
||||
min = 999999999999
|
||||
max = 0
|
||||
for(c in countl){
|
||||
count[c] = countl[c]>countr[c] ? countl[c] : countr[c]
|
||||
if(count[c]>max) max=count[c]
|
||||
if(count[c]<min) min=count[c]
|
||||
}
|
||||
if(s==10) print "part 1: ", max-min
|
||||
if(s==40) print "part 2: ", max-min
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue