#C12905. Shift and Count Even Numbers
Shift and Count Even Numbers
Shift and Count Even Numbers
You are given a list of integers and a nonnegative integer shift. Your task is to perform a right shift on the list by shift positions, and then determine the number of even integers in the shifted list. A right shift means that each element moves to the right, and the elements at the end wrap around to the beginning.
The effective shift is computed as \(shift \mod n\), where \(n\) is the length of the list. For example, if the list is [1, 2, 3, 4, 5, 6] and \(shift = 2\), the list becomes [5, 6, 1, 2, 3, 4] after shifting, and the number of even integers is 3.
inputFormat
The input consists of three lines:
- The first line contains a single integer \(n\) representing the number of elements in the list.
- The second line contains \(n\) space-separated integers. If \(n = 0\), this line will be empty.
- The third line contains a nonnegative integer \(shift\) indicating the number of positions to shift the list to the right.
outputFormat
Output a single integer denoting the number of even numbers in the shifted list.
## sample6
1 2 3 4 5 6
2
3