1 #include <bits/stdc++.h> 2 using namespace std; 3 bool vis[15]; 4 bool check(long long a,long long b){ 5 memset(vis,0,sizeof(vis)); 6 while(a) 7 if(!vis[a%10])vis[a%10]=1,a/=10; 8 else return false; 9 while(b) 10 if(vis[b%10])return false; 11 else b/=10; 12 return true; 13 } 14 int main(){//output: 639172 15 for(long long i=1e5;i<1e6;i++) 16 if(i==203879)continue; 17 else if(check(i,i*i)){ 18 cout<<i<<endl; 19 return 0; 20 } 21 }