有没有21寸到32寸之间的显示器# PDA - 掌中宝
d*x
1 楼
只能使用 ! ~ & ^ | + << >>
可以用 =,可定义局部变量,字长32bit,右移是算数右移,不许cast
常量只能在0~0xff之间。实际上一般面试不会有这个约束,就忽略吧
1. int isAsciiDigit(int x);
如果x是'0'~'9',返回1,否则返回0
2.int anyEvenBit(int x);
如果任何偶数位上有1返回1 (1 --> 1, 2 --> 0)
3.int copyLSB(int x);
如果x & 1,则返回0xffffffff,否则返回0
4.int leastBitPos(int x);
5.int divpwr2(int x, int n);
输出 x / pow(2, n);,n非负。
6.int conditional(int x, int y, int z);
相当于x ? y : z
7.int isNonNegative(int x);
非负数返回1
8.int isGreater(int x, int y);
如果x > y,返回1
9.int absVal(int x);
返回x的绝对值
10.int isPower2(int x);
如果x是pow(2, n),则返回1.对于所有负数返回0
11.int bitCount(int x);
返回x的2进制表示的1的个数。
因为作业due已经过去很久了所以应该没啥policy问题。。
至今最少的操作符个数是
1.6 2.7 3.2 4.3 5.6 6.6 7.2 8.8
9.3 10.7 11.24
可以用 =,可定义局部变量,字长32bit,右移是算数右移,不许cast
常量只能在0~0xff之间。实际上一般面试不会有这个约束,就忽略吧
1. int isAsciiDigit(int x);
如果x是'0'~'9',返回1,否则返回0
2.int anyEvenBit(int x);
如果任何偶数位上有1返回1 (1 --> 1, 2 --> 0)
3.int copyLSB(int x);
如果x & 1,则返回0xffffffff,否则返回0
4.int leastBitPos(int x);
5.int divpwr2(int x, int n);
输出 x / pow(2, n);,n非负。
6.int conditional(int x, int y, int z);
相当于x ? y : z
7.int isNonNegative(int x);
非负数返回1
8.int isGreater(int x, int y);
如果x > y,返回1
9.int absVal(int x);
返回x的绝对值
10.int isPower2(int x);
如果x是pow(2, n),则返回1.对于所有负数返回0
11.int bitCount(int x);
返回x的2进制表示的1的个数。
因为作业due已经过去很久了所以应该没啥policy问题。。
至今最少的操作符个数是
1.6 2.7 3.2 4.3 5.6 6.6 7.2 8.8
9.3 10.7 11.24