题解 | #自守数#
自守数
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;
}