题解 | #守形数#

守形数

https://www.nowcoder.com/practice/99e403f8342b4d0e82f1c1395ba62d7b

#include <iostream>
using namespace std;
string func(int n){
    int nn =n*n;
    if(nn<10)return "No!";
    string snn = to_string(nn);
    snn = snn.substr(1,snn.length());
    if(snn == to_string(n))return "Yes!";
    return "No!";
}
int main() {
    int n;
    while(cin>>n)
        cout<<func(n)<<endl;
}
// 64 位输出请用 printf("%lld")

qd

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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