#P12133. Mining Production Adjustment
Mining Production Adjustment
Mining Production Adjustment
In a remote town, three brothers jointly operate a small mining company named "Brothers Mining". The company manages three mines: a gold mine, a silver mine, and a copper mine. Their initial production values are represented by non-negative integers \(A\), \(B\), and \(C\) respectively. These mines are the backbone of the town's economy, supporting the brothers and many miner families.
However, the production values can fluctuate dramatically. Sometimes the gold mine performs well while the silver and copper mines lag, and sometimes the opposite occurs. To stabilize operations and avoid disputes, the brothers designed a fair adjustment strategy. Each year, they update the production values simultaneously based on the current values \(A\), \(B\), and \(C\) as follows:
- Gold mine: \(A' = \lfloor \frac{B+C}{2} \rfloor\)
- Silver mine: \(B' = \lfloor \frac{A+C}{2} \rfloor\)
- Copper mine: \(C' = \lfloor \frac{A+B}{2} \rfloor\)
The floor function, \(\lfloor \cdot \rfloor\), returns the greatest integer less than or equal to its argument (for example, \(\lfloor 3.7 \rfloor = 3\) and \(\lfloor 5.2 \rfloor = 5\)). After computing \(A'\), \(B'\), and \(C'\), these new values become the basis for the next year's adjustment.
The brothers plan to apply this strategy consecutively for \(K\) years. Your task is to compute the production values of the gold, silver, and copper mines after \(K\) adjustments.
inputFormat
The input consists of a single line with four non-negative integers: \(A\), \(B\), \(C\), and \(K\), separated by spaces.
outputFormat
Output three integers separated by spaces, representing the production values of the gold, silver, and copper mines after \(K\) adjustments.
sample
0 0 0 1
0 0 0