There is a series with the length of n (n100), which is defined as an ascending and ordered even number (2, 4, 6, 8, 10,…) starting from 2 ,...), Now you are required to calculate an average by the number of m in order. If there are less than m at the end, calculate the average by the actual number. Program the output of the average sequence. Input: the input data contains two positive integers n and m, n indicates the length of the series, m
There is a series with a length of n (n = 100), which is defined as an ascending and ordered number (2, 4, 6, 8, 10,…) starting from 2 ,...), Now you are required to calculate an average by the number of m in order. If there are less than m at the end, calculate the average by the actual number. Program the output of the average sequence. Input: the input data contains two positive integers n and m, n indicates the length of the series, m
There is a series with a length of n (n <= 100), which is defined as an ascending and ordered number (2, 4, 6, 8, 10,…) starting from 2 ,...), Now you are required to obtain an average value for each m number in order. If there are less than m at last, the average value is calculated based on the actual number. Program the output of the average value sequence.
Input:
The input data contains two positive integers n and m. n indicates the length of the sequence, and m indicates the length of the subsequence that calculates the average value in order.
Output:
Output the average sequence of this set of data.
Input example:
4 2
Output example:
3 7
# Include
Using namespace std; int main () {int m, n, I, j, k = 0, t = 0; int a [100]; cin >> n> m; for (I = 0; I
未验证