题解 | 汽水瓶
汽水瓶
https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
#include <iostream> using namespace std; int main() { int bot=0,emp_bot; while(cin >> emp_bot){ if(emp_bot == 0) break; if(emp_bot == 1) { cout<<0<<endl; continue; } while(emp_bot /3 !=0){ bot += emp_bot/3; emp_bot = emp_bot/3+emp_bot%3; } if(emp_bot == 2) { bot+=1; } cout << bot <<endl; bot=0; } } // 64 位输出请用 printf("%lld")