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