| UT 104c Midterm #1 |
|---|
| Закончено |
There is a well-known formula for the sum $$$f(n)$$$ of the first $$$n$$$ squares, $$$$$$f(n) = 1^2 + 2^2 + 3^2 + \ldots + n^2 = \frac{n(n+1)(2n+1)}{6}.$$$$$$
Write a function that computes $$$n$$$ given $$$f(n)$$$.
The first line of input contains a single integer $$$T$$$, the number of test cases $$$(1 \leq T \leq 10\,000)$$$. Each of the following $$$T$$$ lines contain a single integer $$$k$$$ $$$(1 \leq k \leq 2^{60})$$$.
For each test case, print a line with the positive integer $$$n$$$ satisfying $$$f(n) = k$$$. It is guaranteed that such an integer exists.
515143851152919708258615990
1 2 3 10 1512307
Hint: the largest possible value of $$$n$$$ with $$$f(n) \leq 2^{60}$$$ is $$$n=1512307$$$.
| Название |
|---|


