1 solutions

  • 0
    @ 2025-12-2 15:35:38

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n,s=0;
    	cin>>n;
    	s=n;
    	for(int t;n>=3;)
    	{
    		t=n/3;
    		s+=t;
    		t+=n%3;
    		n=t;		
    	} 
    	cout<<s; 
    	return 0;
    }
    
    
    • 1

    Information

    ID
    650
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    2
    Accepted
    2
    Uploaded By