Redian新闻
>
两UINT数相乘,再加上一个UINT数,最少需要多少个bit?
avatar
两UINT数相乘,再加上一个UINT数,最少需要多少个bit?# JobHunting - 待字闺中
n*g
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?
谢啦!
avatar
S*I
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?
: 谢啦!

avatar
n*g
3

怎么得出的?

【在 S**I 的大作中提到】
: 2N
:
: min

avatar
p*2
4

Prelude> 999*999+999
999000

【在 n*****g 的大作中提到】
:
: 怎么得出的?

avatar
S*I
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 的大作中提到】
:
: 怎么得出的?

avatar
l*b
6
2N+1?
avatar
l*b
7
got it wrong... what a shame

【在 l*******b 的大作中提到】
: 2N+1?
avatar
b*e
8
log(A*B) = logA + LogB = N + N =2N
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。