提交时间:2022-08-08 11:31:11
运行 ID: 54926
#include<bits/stdc++.h> using namespace std; inline int read() { static int x=0,c=getchar() ; for(; c<=47||c>=58; c=getchar()); for(x=0; c>=48&&c<=57; c=getchar()) x=(x<<3)+(x<<1)+(c&15); return x; } int main() { int t; cin>>t; while(t--) { int ans=0,n=read(); for(int i=2; i*i<=n; i++) //a+b=i^2 { if((i*i)%4==0) { for(int k=1; i*i*k<=n; k++) ans++; } else if((i*i)%2==0) { for(int k=2; i*i*k<=n; k+=2) ans++; } else { ans++; for(int k=4; i*i*k<=n; k+=4) ans++; } } cout<<ans<<endl; } return 0; }