Topic:
Sum of squares and cubic andTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 108212 Accepted Submission (s): 34915
Problem description Given a continuous number of integers, the sum of all the even squares of all of them, and all the odd cubes.
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, one 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
Authorlcy
SOURCEC Language Programming Exercises (I.)
Topic Analysis:
Simple question.
The code is as follows:
/* * c.cpp * * Created on:2015 March 20 * author:administrator * * #include <iostream> #include <cstdio># Include <cmath>using namespace Std;int main () {int a,b;while (scanf ("%d%d", &a,&b)!=eof) {double Ans_ji = 0; Double Ans_ou = 0;int i;//The problem needs to be noted is to consider the case of B<a if (b < a) {swap (A, a);} for (i = A; I <= b; ++i) {if (i% 2 = = 1) {Ans_ji + = POW (i+0.0,3);} Else{ans_ou + = POW (i+0.0,2);}} printf ("%d%d\n", (int) ans_ou, (int) ans_ji);} return 0;}
(Hdu simple question 128) squared sum with cubic and (ask for an interval of cubic sum and sum of squares)