Problem 3920 --Squares and Cubes

3920: Squares and Cubes

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $4$ 正确数量 $3$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 数学




Polycarp likes squares and cubes of positive integers. Here is the beginning of the sequence of numbers he likes: 11448899, ....

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).





The first line contains an integer tt (1≤t≤201≤t≤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≤n≤109).

For each test case, print the answer you are looking for — the number of integers from 1 to n that Polycarp likes.
6
10
1
25
1000000000
999999999
500000000
4
1
6
32591
32590
23125

推荐代码 查看3920 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$24 $ms] 只能过个样例~~~ 802444 2021-12-21 22:18:35
内存最少[$2332 $KB] 只能过个样例~~~ 802444 2021-12-21 22:18:35
第一AC 只能过个样例~~~ 802442 2021-12-21 22:17:06
第一挑战 只能过个样例~~~ 802442 2021-12-21 22:17:06

赛题来源/所属竞赛 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛