求调:
#include<bits/stdc++.h>
using namespace std;
long long n,sn,tmp;
long long f(long long x){
long long sum=0;
while(x!=0){
sum+=x%10;
x/=10;
}
return x*x+sum*x;
}
int main(){
cin>>n;
sn=sqrt(n);
for(int i=sn-81;i<sn;i++){
if(f(i)==n){
tmp=1;
cout<<i;
break;
}
}
if(tmp==0)
cout<<-1;
return 0;
}