2 solutions

  • 1
    @ 2025-7-10 11:14:32
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n,m=0;
    	cin>>n;
    	for(int i=1;i<=n;i++){
    		m+=i*i*i;
    		if(m>n){
    			cout<<i-1;
    			return 0;
    		}  
    	}
    	return 0;
    }
    
    
    
    • 0
      @ 2026-8-24 20:11:29
      #include<bits/stdc++.h>
      using namespace std;
      #define int long long
      int n,m;
      signed main()
      {
      	cin>>n;
      	while(m*m*(m+1)*(m+1)<=4*n)
      	{
      		m++;
      	}
      	cout<<m-1;
      	return 0;
      }
      
      • 1

      Information

      ID
      2842
      Time
      1000ms
      Memory
      64MiB
      Difficulty
      1
      Tags
      # Submissions
      62
      Accepted
      28
      Uploaded By