题解 | #对称平方数1#

对称平方数1

https://www.nowcoder.com/practice/a84d46d5321f4e20931cb725e6c74fad

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

bool judge(int in)
{
    string s = to_string(in);
    string temp = s;
    reverse(s.begin(), s.end());
    return temp == s;
}


int main() {
    for(int i = 0;i < 256;i++){
        if(judge(i*i))
            cout << i << endl;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

1 收藏 评论
分享
牛客网
牛客企业服务