Company: Opentext_13nov
Difficulty: medium
Bomb Defusal Sequence Generation Problem Description During the war, the enemy battalion has planted a bomb in your bunker. Your informer has sent you a message of the enemy which contains a list having N numbers and a key. The numbers are used to construct a sequence to defuse the bomb. According to your informer, the logic to extract the sequence from the whole message is by replacing each number with the sum of the next key numbers. When the value of the key is negative, the number is replaced by the sum of the previous key numbers. The series of numbers is considered in a cyclic fashion for the last key numbers. Write an algorithm that finds the sequence to defuse the bomb. Input Format The first line of the input consists of two space-separated integers - N and key representing the size of the list and the key, respectively. The second line consists of N space-separated integers - arr[1], arr[2], ..., arr[N] representing the elements of the list. Output Format Print N space-separa