3 solutions

  • 2
    @ 2026-6-6 10:43:51
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long LL; 
    LL check(LL x)
    {
    	LL res=0;
    	LL t=x;
    	while(x)
    	{
    		LL ge=x%10;
    		res=res*10+ge;
    		x/=10;
    	}
    	//cout<<res<<" "<<t<<endl;
    	return res==t;
    }
    int main()
    {
    	LL n;
    	cin>>n;
    	LL ans=1;
    	for(LL i=1;i*i*i<=n;i++) //枚举三次方 
    	{
    		if(check(i*i*i))
    		{
    			ans=i*i*i;
    		//	cout<<ans<<endl;
    		}
    	}
    	cout<<ans;
    	return 0;
    }
    
    
    • 1
      @ 2026-7-24 11:40:07
      #include<bits/stdc++.h>
      using namespace std;
      long long check(long long x)
      {
      	long long res=0;
      	long long t=x;
      	while(x)
      	{
      		long long ge=x%10;
      		res=res*10+ge;
      		x/=10;
      	}
      	return res==t;
      }
      int main()
      {
      	long long n;
      	cin>>n;
      	long long ans=1;
      	for(long long i=1;i*i*i<=n;i++)
      	{
      		if(check(i*i*i))
      		{
      			ans=i*i*i;
      		}
      	}
      	cout<<ans;
      	return 0;
      }
      • -2
        @ 2026-6-13 15:04:57

        • 1

        Information

        ID
        2437
        Time
        1000ms
        Memory
        256MiB
        Difficulty
        1
        Tags
        (None)
        # Submissions
        43
        Accepted
        15
        Uploaded By