- 只有奇数乘奇数才是奇数,而如果使式子为奇数,只能是2的所有次数或者其他素数的偶数次。
- 素数的次数的任意组合小于等于n的个数有n个,因为每一个数都可以素因子分解成不同的组合。
- 所以奇数有两类,a^2 <= n,或者2是奇数次,2*a^2 <= n,而a就是符合情况的所有组合。
题目链接:http://acm.hust.edu.cn/vjudge/problem/27044
#include<cstdio>
#include<iostream>
#include<sstream>
#include<cstdlib>
#include<cmath>
#include<cctype>
#include<string>
#include<cstring>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<ctime>
#include<vector>
#include<fstream>
#include<list>
using namespace std;
#define ms(s) memset(s,0,sizeof(s))
typedef unsigned long long ULL;
typedef long long LL;
const int INF = 0x3fffffff;
LL n,ans;
int main()
{
// freopen("F:\\input.txt","r",stdin);
// freopen("F:\\output.txt","w",stdout);
// ios::sync_with_stdio(false);
int t;
scanf("%d",&t);
for(int cas = 1; cas <= t; ++cas){
scanf("%lld",&n);
ans = n - (LL)sqrt(n) - (LL)sqrt(n/2);
printf("Case %d: %lld\n",cas,ans);
}
return 0;
}