题解 | #汽水瓶#
汽水瓶
https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
#include <iostream>
using namespace std;
int main(int argc, char* argv[]){
int n;
while(cin >> n){
if(n == 0){
break;
}
int res = 0;
while(n > 2){
int quo = n / 3;
int remainder = n % 3;
res += quo;
n = quo + remainder;
}
if(n == 2){
res += 1;
}
cout << res << endl;
}
return 0;
}