题解 | #守形数#
守形数
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