Computer Science, asked by babedoll6578, 7 months ago

Two friends A and B are playing with an array of integers. They both agree upon the operations to be performed on the array but differ on choice of window size to perform the said operations.
The operations to be performed on the array are explained below:
· One can choose to add at the most X consecutive elements.
· After performing the addition operation, it is mandatory to skip the next element in the array.
· The goal is to achieve maximum sum by choosing appropriate elements in the array.
A wants X to be W, while B wants X to be (W + D). This is the only difference that they have. Your task is to find out who wins. Winner is the person whose sum is higher.
The inputs that will be provided are values of elements of array, value of W and value of D.

Answers

Answered by gyadav30122000
3

Explanation:

Two friends A and B are playing with an array of integers. They both agree upon the operations to be performed on the array but differ on choice of window size to perform the said operations.

The operations to be performed on the array are explained below:

· One can choose to add at the most X consecutive elements.

· After performing the addition operation, it is mandatory to skip the next element in the array.

· The goal is to achieve maximum sum by choosing appropriate elements in the array.

A wants X to be W, while B wants X to be (W + D). This is the only difference that they have. Your task is to find out who wins. Winner is the person whose sum is higher.

The inputs that will be provided are values of elements of array, value of W and value of D.mhi

Similar questions