Time
limit:1000MS
Memory Limit:32768KB
64bit IO Format:%i64d &A mp %i64u
Description
Given a continuous number of integers, the sum of squares of all even numbers is calculated and all the odd cubic and.
Input
The input data contains multiple sets of test instances, each containing a row consisting of two integers m and N.
Output
For each set of input data, the output line should consist of two integers x and y, representing the sum of all the even squares of the consecutive integers in that segment and all the odd cubic and. You can assume that a 32-bit integer is sufficient to save the result.
Sample Input
1 32 5
Sample Output
4 2820 152
#include <stdio.h>intMain () {Longn,m,t; while(SCANF ("%ld%ld", &n,&m)! =EOF) { if(n>m) {T=N; N=m; M=T; } Longi; Longx=0; Longy=0; for(i=n;i<=m;i++) { if(i%2==0) x+=i*i; Elsey+=i*i*i; } printf ("%ld%ld\n", x, y); } return 0;}
Exercise 2 F-sum of squares and cubic and