LightOJ – 1336 Sigma Function

题目链接

参考: https://blog.csdn.net/SSimpLe_Y/article/details/73804147

#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define maxn 0x3f3f3f3f
#define ll long long
using namespace std;

int main() {
  int T,kase=0;
  cin>>T;
  while(T--){  
    ll n;
    cin>>n;
    ll ans=n-(int)sqrt(n)-(int)sqrt(n/2); 
    //sqrt(n)求n以内的完全平方数个数,1,4,9,16可以映射成1,2,3,4,这样就很明白了
    printf("Case %d: %lld\n",++kase,ans);

  }
  return 0;
}