Problem description gives a continuous integer and calculates the sum of squares of all even numbers and the sum of all odd numbers. The input data contains multiple groups of test instances. Each group of test instances contains a row consisting of two integers, M and N. Output for each group of input data, the output line should contain two integers x and y, indicating the sum of the squares of all the even numbers in the continuous integer of the segment and the sum of all the odd numbers of cubes and.
You can think that a 32-bit integer is enough to save the result. Sample input1 32 5 sample output4 2820 152 code:
# Include <stdio. h>
Int main ()
{
Int m, n, I, T;
While (scanf ("% d", & M, & N )! = EOF)
{
Int S1 = 0, S2 = 0;
If (M> N) // note that m <N;
{T = m; M = N; n = T ;}
For (I = m; I <= N; I ++)
{
If (I % 2 = 0)
S 1 = S1 + I * I;
If (I % 2! = 0)
S2 = S2 + I * I;
}
Printf ("% d \ n", S1, S2 );
}
Return 0;
}