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: 11, 44, 88, 99, ....

For a given number nn, count the number of integers from 11 to nn that Polycarp likes. In other words, find the number of such xx that xx is a square of a positive integer number or a cube of a positive integer number (or both a square and a cube simultaneously).

波利卡普喜欢正整数的平方数和立方数。他喜欢的数列开头如下:11, 44, 88, 99, ...。

对于给定的数 nn,统计从 11 到 nn 中波利卡普喜欢的整数个数。换言之,求满足以下条件的 xx 的个数:xx 是某个正整数的平方,或某个正整数的立方(或同时满足两者)。

输入格式

The first line contains an integer tt (1≤t≤201 \le t \le 20) — the number of test cases.

Then tt lines contain the test cases, one per line. Each of the lines contains one integer nn (1≤n≤1091 \le n \le 10^9).

第一行包含一个整数 tt(1≤t≤201 \le t \le 20)—— 测试用例的数量。

接下来 tt 行,每行包含一个测试用例。每行包含一个整数 nn(1≤n≤1091 \le n \le 10^9)。

输出格式

For each test case, print the answer you are looking for — the number of integers from 11 to nn that Polycarp likes.

对于每个测试用例,输出你所要求的答案——即从 11 到 nn 中 Polycarp 喜欢的整数的个数。

输入输出样例

  • 输入#1

    6
    10
    1
    25
    1000000000
    999999999
    500000000

    输出#1

    4
    1
    6
    32591
    32590
    23125

输入解题思路,AI测评打分。不知道怎么写?

首页