n*****g 发帖数: 178 | 1 Careercup上有一个小题,想问问大家怎么得出2N这个答案?:
Assuming you have three N bit unsigned integers a, b and c, what is the min
number of bits you would need to store the result of a * b + c?
谢啦! |
S**I 发帖数: 15689 | 2 2N
min
【在 n*****g 的大作中提到】 : Careercup上有一个小题,想问问大家怎么得出2N这个答案?: : Assuming you have three N bit unsigned integers a, b and c, what is the min : number of bits you would need to store the result of a * b + c? : 谢啦!
|
n*****g 发帖数: 178 | 3
怎么得出的?
【在 S**I 的大作中提到】 : 2N : : min
|
p*****2 发帖数: 21240 | 4
Prelude> 999*999+999
999000
【在 n*****g 的大作中提到】 : : 怎么得出的?
|
S**I 发帖数: 15689 | 5 max of a, b and c is 2^n-1; (2^n-1) * (2^n-1) + (2^n-1) = 2^2n - 2^n. 2n
bits is enough.
【在 n*****g 的大作中提到】 : : 怎么得出的?
|
l*******b 发帖数: 2586 | |
l*******b 发帖数: 2586 | 7 got it wrong... what a shame
【在 l*******b 的大作中提到】 : 2N+1?
|
b*****e 发帖数: 131 | 8 log(A*B) = logA + LogB = N + N =2N |