提交时间:2020-08-16 08:41:36

运行 ID: 5884

#include<bits/stdc++.h> using namespace std; int main(){ int k=1,b,sum; while(k){ sum=0; cin>>b; if(b==0) break; while(b/3){ sum+=b/3; b=b/3+b%3; } if(b%3==2) cout<<sum+1<<endl; else cout<<sum<<endl; } return 0; }