#include<assert.h> int main() { int a; int count = 0;//记录可喝的可乐数 while (cin >> a) { int x, y; count = 0;//初始化记录可乐数(循环操作中用到) while (a >= 3) { x = a / 3; y = a % 3; a = x + y; count += x; } if (a == 2)// a出来后一定小于三 cout << count + 1 << endl; else cout << count << endl; } return 0; }