题解 | B=A×A
B=A×A
https://www.nowcoder.com/practice/21132ecf432b45a5a8187ea074a5d71e
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
long long b,a;
while(t--){
cin>>b;
a=sqrt(b*1.0);
if(a*a<b){
while(a*a<b)a++;
a--;
}
else {
while(a*a>b)a--;
}
cout<<a<<endl;
}
return 0;
}
// 64 位输出请用 printf("%lld")
查看18道真题和解析