HDU1977 consecutive sum II "water problem"

Source: Internet
Author: User

consecutive sum II

Time limit:3000/1000 MS (java/others) Memory limit:32768/32768 K (java/others) total submission (s): 2237 Accepted S Ubmission (s): 1093
Problem Description
Consecutive sum come again. Is it ready? Go ~ ~
1 = 0 + 1
2+3+4 = 1 + 8
5+6+7+8+9 = 8 + 27
...
You can see the consecutive sum can is representing like that. The nth line'll has 2*n+1 consecutive numbers on the left and the first number on the right equal with the second number I n last line, and the sum of the left numbers equal with the number ' s sum in the right.
Your task is this tell me the right numbers in the nth line.

Input
The first integer is T, and T lines would follow.
Each line would contain an integer n (0 <= n <= 2100000).

Output
For each case, the output of the right numbers on the Nth line.
All answer in the range of signed 64-bits Integer.

Sample Input
3
0
1
2

Sample Output
0 1
1 8
8 27

Author

Wiskey


Title: Recursive, input N, output is n*n*n (n+1) * (n+1) * (n+1)


#include <iostream>using namespace Std;int main () {    __int64 A;    int T;    Cin >> T;    while (t--)    {        cin >> A;        cout << a*a*a << << (a+1) * (a+1) * (a+1) << Endl;    }    return 0;}


HDU1977 consecutive sum II "water problem"

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.