提交时间:2020-08-17 13:29:30
运行 ID: 5932
#include<iostream> using namespace std; int main() { int n; while(cin>>n) { if(n==0) return 0; int ans=0; ans+=n/3; n=n%3; n+=ans; while(n>=3) { int s=n/3; ans+=s; n=n%3; n+=s; } cout<<ans<<endl; } return 0; }