n & 1

n&1==0:偶数

n&1!=0:奇数

原文地址:https://www.cnblogs.com/mcyushao/p/10534792.html