题解 | #汽水瓶#
汽水瓶
https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
#include <iostream> using namespace std; int main() { int a; while (cin >> a) { if (a == 0) { break; } int res = 0; while (a > 2) { int temp = a / 3; res += temp; a = a % 3 + temp; } if (a == 2) { res += 1; } cout << res << endl; } return 0; }