#C10656. Rotate and Check Array Sum
Rotate and Check Array Sum
Rotate and Check Array Sum
You are given an array (a) of (n) integers. Your task is to rotate this array (k) times to the right and then determine if the sum of the first (m) elements of the rotated array is greater than a given integer (s).
The right rotation is defined as moving the last (k) elements of the array to the front while preserving their order. Formally, if the original array is (a = [a_1, a_2, \ldots, a_n]), then the rotated array (a_{\text{rotated}}) is given by:
[
a_{\text{rotated}} = [a_{n-k+1}, a_{n-k+2}, \ldots, a_n, a_1, a_2, \ldots, a_{n-k}]
]
Your program should output "Yes" if (\sum_{i=1}^{m} a_{\text{rotated}}[i] > s) holds; otherwise, output "No".
inputFormat
The input is read from standard input (stdin) and consists of multiple test cases. The first line contains an integer (T), the number of test cases. Each test case is described as follows:
1. The first line of a test case contains three integers (n), (m), and (k) separated by spaces, where (n) is the number of elements in the array.
2. The second line contains (n) space-separated integers representing the array (a).
3. The third line contains a single integer (s).
outputFormat
For each test case, output a single line to standard output (stdout). The line should contain either "Yes" if the sum of the first (m) elements in the rotated array is greater than (s), or "No" otherwise.## sample
2
6 3 2
1 2 3 4 5 6
12
5 2 0
4 5 1 2 3
6
No
Yes
</p>