1 solutions

  • 0
    @ 2024-12-20 22:52:19

    C++ :

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    using namespace std;
    char a[100000000];
    int main()
    {
    	int n,m,i,j,k,t=0;
    	cin>>n;
    	for (k=10;k<=floor(sqrt(n));k++)
    	{
    		m=k*k;
    		sprintf(a,"%d",m);
    		i=0;j=strlen(a)-1;
    		while (i<j&&a[i]==a[j]) {i++;j--;}
    		if (i>=j){
    			t++;
    			if (t==1) cout<<m;
    			else cout<<" "<<m;
    		}
    	}
    	cout<<endl;
    	return 0;
    }
    
    
    • 1

    Information

    ID
    794
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    1
    Accepted
    1
    Uploaded By