Bamboo Green 2551

Source: Internet
Author: User

Problem Description

"Pro-current range mirror tow soul fall red green skirt faintly to dream as true tears wet Trinidad Cloud"
In the MCA Mountain, in addition to live in many martial arts gallant, but also living a low-key outside man, his name by green dress, because often called "bamboo Dragonfly", eventually renamed to Green, perennial seclusion in the mountains, no longer see outsiders. According to the people around the mountain, there is a strange hobby, From the day he lived in, he began planting bamboo around his yard, planting 1 bamboos in the 1th month, 8 bamboos in the 2nd month, and 27 bamboos in the 3rd month ... The first N months of the species (n^3) roots of bamboo. He said that when he planted the first bamboo, he was back in the lake! Tell you the value of x, can you figure out the green comeback will be in the first few months?

Input

First enter a T, which indicates that there is a T-group of data, followed by a T-line. Each line is an integer x,x < 1000000000

Output

Outputs an integer n, indicating a comeback in the nth month

Sample Input

3

1

2

10

Sample Output

1

2

3

 #include <iostream> int main (int argc, const char* argv[]) {int ncases = 0;
    Std::cin >> ncases;
        while (ncases--) {int n = 0;
        Std::cin >> N;
        int nSum = 0;
            for (int i=1;; ++i) {nSum + = I*i*i;
                if (nSum >= N) {std::cout << i << Std::endl;
            Break
}}} return 0; }

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.