题解 | #守形数#
守形数
https://www.nowcoder.com/practice/99e403f8342b4d0e82f1c1395ba62d7b
#include <iostream> #include<sstream> #include<string> using namespace std; int main(int argc, char** argv) { int a; int b;int c;int d; string s1; string s2; stringstream ss,ss1; cin>>a; b=a*a; ss<<b; ss>>s1; ss1<<a; ss1>>s2; c=s1.length()-s2.length(); if(s1.find(s2,c)!=s1.npos){ cout<<"Yes!"<<endl; } else cout<<"No!"<<endl; return 0; }