99 ^ 99 in C [英] 99 ^ 99 in C

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

问题描述

我知道在C中计算99 ^ 99非常困难。它不仅难以获得o / p而且耗费时间。


但perl口译员如何计算它($ x = 99 ** 99;打印4x;)

秒内??? /


算法算法吧使用???

解决方案

x = 99 ** 99;打印4x;)

在几秒钟内??? /


它使用哪种算法???


< blockquote> 9月27日下午3:55,asit< lipu ... @ gmail.comwrote:


我知道计算99 ^ 99真的很难在C.它不仅难以获得o / p而且耗费时间。



你错了。

99 ^ 99在C中是0(^是XOR,不是一些指数运算符)


但perl解释器如何计算它(


x = 99 ** 99; print 4x;)

在几秒钟内??? /

它使用哪种算法?



哪个perl实现? (不要回答)

允许实现它想要它。

偶数s / 99 **

99 / 36972963764972677265718790562880544059566876428174 11024302599724235525704552775234214106500101282327 27940978889548326540119429996769494359451621570193 644014418071060667659301384999779999159200499899 /

;-)


。对于一个严肃的回答,你可能想看看在

BIGNUM库C.

GMP是最好的免费之一。

< http://gmplib.org/>


要计算99 ** 99,你会得到:

mpz_t x;

mpz_init(x);

mpz_ui_powm_ui(x, 99,99); / * x = 99 ** 99 * /

/ * ... * /

mpz_clear(x);

然而,它'重要的是要注意你不应该问更多的问题

关于gmp lib,因为它在这里是偏离主题的。


I know it is really tough to calculate 99^99 in C. Its not only
difficult but also time consuming to get the o/p.

But how perl interpreter calculates it( $x = 99 ** 99; print 4x;)
within seconds???/

which algorithm it uses ???

解决方案

x = 99 ** 99; print 4x;)
within seconds???/

which algorithm it uses ???


On Sep 27, 3:55 pm, asit <lipu...@gmail.comwrote:

I know it is really tough to calculate 99^99 in C. Its not only
difficult but also time consuming to get the o/p.

You''re mistaken.
99^99 is 0 in C. (^ is XOR, not some expontation operator)

But how perl interpreter calculates it(


x = 99 ** 99; print 4x;)
within seconds???/
which algorithm it uses ???

Which perl implementation? (Don''t answer)
The implementation is allowed to calculate it however it wants.
Even s/99 **
99/36972963764972677265718790562880544059566876428174 11024302599724235525704552775234214106500101282327 27940978889548326540119429996769494359451621570193 644014418071060667659301384999779999159200499899/
;-)

For a serious answer, you might want to look into bignum libraries in
C.
GMP is one of the best and free.
<http://gmplib.org/>

To calculate 99 ** 99, you''d have:
mpz_t x;
mpz_init(x);
mpz_ui_powm_ui(x, 99, 99); /* x = 99 ** 99 */
/* ... */
mpz_clear(x);
However, it''s important to note you shouldn''t ask further questions
about gmp lib, since it''s off-topic here.


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

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