bool canBeDividedBy3(int nextBit)
{
static int remainder = 0;
remainder = (remainder * 2 + nextBit) % 3;
return (remainder == 0);
};
一个无限的比特流每次只能读一个比特 判断当前的数是不是被3整除
最新推荐文章于 2024-04-01 08:09:00 发布
bool canBeDividedBy3(int nextBit)
{
static int remainder = 0;
remainder = (remainder * 2 + nextBit) % 3;
return (remainder == 0);
};