This is a task from the Advent of Code project. In order to run, you need an x86 linux machine. Copying this code is only allowed as mentioned in License.
- There is a given diagnostic report (multiple binary values in text form).
- Each bit in the gamma rate can be determined by finding the most common bit in the corresponding position of all numbers in the diagnostic report.
- The epsilon rate is calculated in a similar way; rather than use the most common bit, the least common bit from each position is used.
- The power consumption can be calculated by multiplying the gamma rate by the esilon rate.
- The output will show the binary gamma and epsilon value, as well as the decimal power consumption.
Generate program:
make
Execute binary-diagnostic:
./binary-diagnostic64