提交时间:2025-01-24 10:02:56

运行 ID: 5227

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