84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
【java数据结构和算法】给定一个数n,将其扩大为原来的15倍,不能使用乘法、除法和加法,这个怎么写呢,谢谢?
欢迎选择我的课程,让我们一起见证您的进步~~
Hmm, I was confused just now. Shift left by 4 bits and subtract n. Without considering overflow.16=2^4
(n<<4)-n
public class Test { public static void main(String[] args) { System.out.println(expand15Times(100)); } private static int expand15Times(int n) { return (n << 4) - n; } }
Hmm, I was confused just now.
Shift left by 4 bits and subtract n. Without considering overflow.
16=2^4