题解 | B=A×A

B=A×A

https://www.nowcoder.com/practice/21132ecf432b45a5a8187ea074a5d71e

#include<bits/stdc++.h>
#include <cmath>
using namespace std;
#define ll long long
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        ll b;
        scanf("%lld",&b);
        ll a=sqrt(b)-10;
        if(a<0) a=0;
        while(a*a<=b)
        {
            a++;
        }
        printf("%lld\n",a-1);
    }
    return 0;
}

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务