457 - Linear Cellular Automata


Difficulty : easy

Solution Description :

Ad hoc problem

for i=0 to 9
----input dna[i]

at first day set all value 0 to a[40] and only set a[19]=1

For next day
for location i
---set n = a[i-1] + a[i] + a[i+1] // here all a[] values  --- previous day
---set next value for next day[i] = dna[n]

Make sure you don't have an extra blank line at the end of your output. There should be a blank line *between* cases only.