CF1619B.Squares and Cubes
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Polycarp likes squares and cubes of positive integers. Here is the beginning of the sequence of numbers he likes: 1, 4, 8, 9, ....
For a given number n, count the number of integers from 1 to n that Polycarp likes. In other words, find the number of such x that x is a square of a positive integer number or a cube of a positive integer number (or both a square and a cube simultaneously).
波利卡普喜欢正整数的平方数和立方数。他喜欢的数列开头如下:1, 4, 8, 9, ...。
对于给定的数 n,统计从 1 到 n 中波利卡普喜欢的整数个数。换言之,求满足以下条件的 x 的个数:x 是某个正整数的平方,或某个正整数的立方(或同时满足两者)。
输入格式
The first line contains an integer t (1≤t≤20) — the number of test cases.
Then t lines contain the test cases, one per line. Each of the lines contains one integer n (1≤n≤109).
第一行包含一个整数 t(1≤t≤20)—— 测试用例的数量。
接下来 t 行,每行包含一个测试用例。每行包含一个整数 n(1≤n≤109)。
输出格式
For each test case, print the answer you are looking for — the number of integers from 1 to n that Polycarp likes.
对于每个测试用例,输出你所要求的答案——即从 1 到 n 中 Polycarp 喜欢的整数的个数。
输入输出样例
输入#1
6 10 1 25 1000000000 999999999 500000000
输出#1
4 1 6 32591 32590 23125
输入解题思路,AI测评打分。不知道怎么写?