#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
int c[] = {0,9,8,7,6,5,4,3,2,1};
bool check(unsigned long long x){
// printf("%llu\n",x);
int s[20],len = 0;
while(x){s[len++] = x % 10;x /= 10;}
if(len != 19) return false;
for(int i = 0,j = 0;i < len; i += 2,++j){
if(s[i] != c[j]) return false;
}
return true;
}
int main() {
// cout << check(1122334455667788990LL) << endl;
for(unsigned long long i = 1000000000;; i += 10){
if(check(i * i)){
printf("%llu\n",i);break;
}
}
return 0;
}
// the method is not very good.
لینک سوال در ProjectEuler