1 solutions

  • 0
    @ 2025-9-7 11:43:58
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	while(cin>>n,n)
    	{
    		int ans=0;
    		while(n>=3)
    		{
    			ans+=n/3;
    			n=n/3+n%3;
    		}
    		if(n==2) ans++;
    		cout<<ans<<endl;
    	}
    	return 0;
    }
    
    

    Information

    ID
    2879
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    # Submissions
    20
    Accepted
    13
    Uploaded By