When you arrive at Mud Volcano, you realize that you only have one memoy card for your camera, and space is running low. You need to figure out if you have enough space or if you need to make an emergency run to Fishing Bridge for a new card. The number of photos you need for each thermal feature is expressed as an equation in postfix notation. While this might be a daunting task, it turns out that all the equations follow the same postfix notation format:
N1 N2 op1 N3 N4 op2 op3
The values are separated by tabs.
The infix solution to each equation is:
(N1 op1 N2) op3 (N3 op2 N4)
Some examples:
Postfix equation | Infix | Answer |
---|---|---|
2 3 + 4 5 + + |
(2 + 3) + (4 + 5) |
14 |
2 3 + 4 5 + * |
(2 + 3) * (4 + 5) |
45 |
Determine the number of photos for each feature and sum them across all features.
The number of photos using the test input is 27302287.
How many photos do you need space for?Copyright 2022 Robin A. Reynolds-Haertle