提交时间:2020-08-22 22:36:14

运行 ID: 5979

#include<bits/stdc++.h> using namespace std; int main(){ int n; while(scanf("%d",&n)&&n){ int sum=0; while(n>=2){ sum+=n/3; n=n/3+n%3; if(n==2){ sum++; break; } } cout<<sum<<endl; } return 0; }