Your friend Eliud inherited a farm from her grandma Tigist. Her granny was an inventor and had a tendency to build things in an overly complicated manner. The chicken coop has a digital display showing an encoded number representing the positions of all eggs that could be picked up.
Eliud is asking you to write a program that shows the actual number of eggs in the coop.
The position information encoding is calculated as follows:
- Scan the potential egg-laying spots and mark down a
1
for an existing egg or a0
for an empty spot. - Convert the number from binary to decimal.
- Show the result on the display.
_ _ _ _ _ _ _
|E| |E|E| | |E|
_ _ _ _ _ _ _
|1|0|1|1|0|0|1|
89
4
_ _ _ _ _ _ _
| | | |E| | | |
_ _ _ _ _ _ _
|0|0|0|1|0|0|0|
16
1