Bamboo Green everywhere
Time limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 4379 Accepted Submission (s): 2485
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 enters 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 that represents the comeback in the nth month
Sample Input
3 1 2 10
Sample Output
1 2 3 cubic and formula: 1^3+2^3+......+n^3= (n^2* (n+1) ^2)/4
#include <cstdio>
#include <cstring>
int main () {
int t;
__int64 X,i;
scanf ("%i64d", &t);
while (t--) {
scanf ("%i64d", &x);
for (I=1;; ++i)
if (i*i* (i+1) * (i+1)/4>=x) {
printf ("%i64d\n", I); break;
}
}
return 0;
}