day 6, more compact

This commit is contained in:
sejo 2021-12-06 07:33:50 -06:00
parent 70952aa975
commit bea8830e33
1 changed files with 13 additions and 0 deletions

13
06/06_newer.awk Normal file
View File

@ -0,0 +1,13 @@
BEGIN{ RS = ","; ngen=256 }
{ c[$i]++ }
END{
for(g=1;g<=ngen;g++){
for(i=0;i<=8;i++) nc[i] = c[(i+1)%9]
nc[6] += c[0]
for(i in nc) c[i] = nc[i]
}
for(i in c) count+=c[i]
print count
}