提交时间:2020-08-18 10:30:21

运行 ID: 5939

#include<bits/stdc++.h> using namespace std; int main(){ int num,ans=0; while(1){ ans=0; cin>>num; if(num==0) break; while(num>=2){ int change=num/3; if(num==2) change=1; ans+=change; num=num-change*3+change; } cout<<ans<<endl; } return 0; }