题解 | #自守数#

自守数

http://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e

using namespace std;

int main(void)
{
    int n;
    int count = 0,x=0;
    double num;
    cin>>n;
    while(n>=0){
       
    num = n*n;
    string str = to_string(n);
    string temp = to_string((int)num);
    temp = temp.substr(temp.size() - str.size());
        if(str == temp)
        {
            x++;
        }
        n--;
    }
    cout<<x<<endl;
}
全部评论

相关推荐

06-25 16:25
梧州学院 Java
愿汐_:项目介绍那么长,然而你做了啥就一句话?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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