#K69412. Pattern Modifier
Pattern Modifier
Pattern Modifier
You are given a pattern represented by 10 integers and a series of commands. Each command is a pair (button, presses) that instructs you to increase the value at the specified button index (0-indexed) in the pattern by the number of presses. Your task is to apply all commands sequentially to the initial pattern and output the resulting pattern.
Note: The input is read from standard input and the output is written to standard output. The pattern always contains exactly 10 integers.
For example, if the initial pattern is
( [1,2,3,4,5,6,7,8,9,10] )
and the commands are
( [(0,5), (1,3), (9,1)] )
then after applying the commands, the final pattern will be
( [6,5,3,4,5,6,7,8,9,11] ).
</p>inputFormat
The input consists of multiple lines:
- The first line contains 10 space-separated integers representing the initial pattern.
- The second line contains an integer \( n \) indicating the number of commands.
- The following \( n \) lines each contain two space-separated integers: the first integer is the button index (between 0 and 9) and the second integer is the number of presses to add.
outputFormat
Output a single line containing the 10 space-separated integers of the final pattern after processing all the commands.
## sample1 2 3 4 5 6 7 8 9 10
3
0 5
1 3
9 1
6 5 3 4 5 6 7 8 9 11