文章
119
粉丝
68
获赞
92
访问
20.1k
#include <iostream>
#include <cmath>
using namespace std;
int countSpecialNumbers(int n) {
int count = 0;
int k = 1;
while (pow(k, 6) <= n) {
count++;
k++;
}
return count;
}
int main() {
int t; // 测试用例的组数
cin >> t;
while (t--) {
int n;
cin >> n;
cout << countSpecialNumbers(n) << endl;
}
return 0;
}
本题按理来说没什么难度,我们只需要找到范围内所有的6次方数即可,那么从1开始搜,一切小于等于n的6次方数都加一,搜一遍即可
登录后发布评论
暂无评论,来抢沙发