2 solutions

  • 0
    @ 2025-11-27 21:31:14

    #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
    60
    Accepted
    23
    Uploaded By