标签:std mod out col ret iostream class clu div
#include <iostream> int main() { int num; while(std::cin>>num) { int mod, left, sum=0; left = mod % 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; }
有这样一道智力题:“某商店规定:三个空汽水瓶可以换一瓶汽水。
标签:std mod out col ret iostream class clu div
原文地址:https://www.cnblogs.com/donggongdechen/p/11915075.html