#P10373. [AHOI2024 初中组 / 科大国创杯初中组 2024] 立方根
[AHOI2024 初中组 / 科大国创杯初中组 2024] 立方根
Background
The testdata for this problem is not official.
We are collecting official testdata (that can be uploaded here).
Official testdata (cannot be uploaded here): https://www.luogu.com.cn/training/499869
Unofficial testdata download: https://scg3.piaoztsdy.cn/training/69bce235a7cf509104565c83
Special notes:
- Please use
(int) cbrt(x + 0.5)to compute , otherwise precision errors may occur. - This problem includes two hack test cases against algorithms with time complexity (#11 and #12).
Problem Description
Xiaokeke wants to compute the sum of the floored cube roots of all positive integers not greater than , but she does not know how. Can you help her?
To fully help Xiaokeke understand this problem, you need to answer queries. For each query, given a positive integer , output:
$$\sum _{j=1} ^{x_i} \lfloor j^{\frac{1}{3}} \rfloor$$Here, denotes the greatest integer not greater than .
Input Format
The first line contains a positive integer .
Then follow lines. The -th line contains a positive integer .
It is guaranteed that is non-decreasing.
Output Format
Output lines. Each line contains a positive integer, representing the answer to that query.
Please pay attention to the range of the answer.
2
5
10
5
13
Hint
Sample 1 Explanation
The floored cube roots of are: .
Constraints
For of the data, .
For another of the data, .
For another of the data, .
For another of the data, , .
For of the data, , .
Translated by ChatGPT 5