Even sum Time Limit: 1000 ms Memory limit: 65536 K any questions? Click Here ^_^ The topic description contains a series of n (n <= 100). The sequence is defined as an ascending, ordered, and even number starting from 2. Now, you need to obtain an average value for each m number in order, if there are less than m at last, calculate the average value based on the actual quantity. Program the output of the average value sequence. There are multiple groups of input data. Each group occupies one row and contains two positive integers n, m, n, and m. For each group of input data, an average value sequence is output, and each group of output occupies one row. Sample Input
3 24 2
Sample output
3 63 7
# Include
Void main ()
{
Int a, l, I, j, m, n, t;
Long int c, B, r;
While (scanf ("% d", & m, & n )! = EOF)
{
If (m % n = 0)
{
R = m/n; a = 2;
For (I = 1; I <= r; I ++)
{B = 0;
For (j = 0; j {B + = a; a = a + 2;
}
C = B/n;
If (I! = R)
Printf ("% ld", c );
Else
Printf ("% ld", c );
} Printf ("\ n ");
}
Else
{
R = m/n; l = m-n * r; t = 2;
For (I = 1; I <= r; I ++)
{
B = 0;
For (j = 0; j {
B + = t;
T = t + 2;
}
C = B/n;
Printf ("% ld", c );
}
B = 0;
For (I = 1; I <= l; I ++)
{
B + = t; t = t + 2 ;}
C = B/l;
Printf ("% ld \ n", c );
}
}
}