There is a series with the length of n (n & lt; = 100), which is defined as an increasing number starting from 2

Source: Internet
Author: User
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

  
   
   


未验证

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.