a * b [英] a * b

查看:92
本文介绍了a * b的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果由于内存限制我们不能使用''multiply',那么如何实现a * b ?

我知道3 * 7可以写成3<<< 3 - 3,但是一般的

解决方案是什么?谢谢。


Vol。

解决方案

Vols写道:


如果由于内存限制我们不能使用''multiply'',那么如何实现a * b实现a * b ?



嗯?内存限制?你到底是什么意思?


我知道3 * 7可以写成3<<<<<<<" 3&b;



尝试一下,你会对结果感到惊讶。


但是一般的

解决方案是什么?谢谢。



3 * 7


或者你可以试试


7 * 3


..


V

-

请删除资金''当用电子邮件回复时,我是'b $ b我没有回复最热门的回复,请不要问


OK 。让我们这样说吧:

如何实现''a * b''(与b相乘)而不使用''*'',

例如

3 * 7 = 21,我们可以这样做3<< 3 - 3 = 21,

但是'a * b'的一般解决方案是什么? '?

谢谢。

Vol

Victor Bazarov写道:


Vols写道:


如果由于内存限制我们不能使用''multiply',那么如何实现a * b ?



嗯?内存限制?你是什​​么意思,确切地说?


我知道3 * 7可以写成3<<<<<<<<" 3&b,



尝试一下,你会对结果感到惊讶。


但是一般的

解决方案是什么?谢谢。



3 * 7


或者你可以试试


7 * 3





V

-

请删除大写''A在回复电子邮件的时候

我没有回复最热门的回复,请不要问


< blockquote> for(int i = 0; i< b-1; i ++)

{

a + = a;

}





for(int i = 0; i< b-1; i ++)

{

b + = b;

}


当乘以正数时会有效...容易适应

也是负面的...


Vols写道:


好​​的。让我们这样说吧:

如何实现''a * b''(与b相乘)而不使用''*'',

例如

3 * 7 = 21,我们可以这样做3<< 3 - 3 = 21,

但是'a * b'的一般解决方案是什么? '?

谢谢。

Vol


Victor Bazarov写道:


Vols写道:


如果由于内存限制我们不能使用''multiply',那么如何实现b
$ b A * b" ?



嗯?内存限制?你到底是什么意思?


我知道3 * 7可以写成3<<<<<<<" 3&b;



尝试一下,你会对结果感到惊讶。


但是一般的

解决方案是什么?谢谢。



3 * 7


或者你可以试试


7 * 3





V

-

请删除大写''A在回复电子邮件的时候

我没有回复最热门的回复,请不要问


If we cannot use ''multiply'' because of the memory limitation, how to
implement "a*b" ?
I know 3*7 can be written as 3<<3 - 3, but what is the general
solution? thanks.

Vol.

解决方案

Vols wrote:

If we cannot use ''multiply'' because of the memory limitation, how to
implement "a*b" ?

Huh? Memory limitation? What do you mean, exactly?

I know 3*7 can be written as 3<<3 - 3,

Try it, you''ll be surprised at the result.

but what is the general
solution? thanks.

3*7

or you could try

7*3

..

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


OK. let''s put this way:
How to implement '' a*b '' ( a multiply with b ) without using '' * '',
for example
3* 7 = 21, we can do this way 3<<3 - 3 = 21,
but what is the general solution for '' a * b'' ?
Thanks.
Vol
Victor Bazarov wrote:

Vols wrote:

If we cannot use ''multiply'' because of the memory limitation, how to
implement "a*b" ?


Huh? Memory limitation? What do you mean, exactly?

I know 3*7 can be written as 3<<3 - 3,


Try it, you''ll be surprised at the result.

but what is the general
solution? thanks.


3*7

or you could try

7*3

.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


for(int i=0; i<b-1; i++)
{
a += a;
}

or

for(int i=0; i<b-1; i++)
{
b += b;
}

That would work when multiply by a positive number... Easy to adapt for
negatives too...

Vols wrote:

OK. let''s put this way:
How to implement '' a*b '' ( a multiply with b ) without using '' * '',
for example
3* 7 = 21, we can do this way 3<<3 - 3 = 21,
but what is the general solution for '' a * b'' ?
Thanks.
Vol
Victor Bazarov wrote:

Vols wrote:

If we cannot use ''multiply'' because of the memory limitation, how to
implement "a*b" ?

Huh? Memory limitation? What do you mean, exactly?

I know 3*7 can be written as 3<<3 - 3,

Try it, you''ll be surprised at the result.

but what is the general
solution? thanks.

3*7

or you could try

7*3

.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


这篇关于a * b的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆