题解 | #汽水瓶#
汽水瓶
http://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
int empty = 0;
while (cin >> n) {
int sum = 0;
while (n > 2) {
empty = n / 3;
sum += empty;
n = n % 3 + empty;
}
if (n == 0) {
return 0;
}
// cout << 'a' << n << endl;
sum += n - 1;
cout << sum << endl;
}
}