有这样一道智力题:“某商店规定:三个空汽水瓶可以换一瓶汽水。
#include <iostream> int main() { int num; while(std::cin>>num) { int mod, left, sum=0; left = num % 3; while(num/3) { mod = num / 3;
left = num % 3; sum += mod; num = mod + left; left = num % 3; } if(left == 1) { sum += 0; } if(left == 2) { sum += 1; } std::cout<<sum<<std::endl; } return 0; }