10 条题解

  • 0
    @ 2021-12-4 12:29:15

    sqrt函数:计算开方
    用法:

    sqrt(double x);
    

    作用:返回x的开方。 注意:需要包括库

    #include <math.h>
    

    本题思路:判断n的开方是否为整数。(好像在C++行不通...) 附上本人AC代码:

    //Write by: FSC711300
    #include <bits/stdc++.h>
    using namespace std;
    int main(){
        int n;
        cin>>n;
        
        if(int(sqrt(n))*int(sqrt(n))==n){
            cout<<sqrt(n);
        }else{
            cout<<"No,Chen";
        }
    }
    
    

    信息

    ID
    880
    时间
    1000ms
    内存
    128MiB
    难度
    4
    标签
    递交数
    718
    已通过
    315
    上传者