pythonchallenge 【第0题】

 新博客地址:http://gorthon.sinaapp.com/

1:

http://www.pythonchallenge.com/pc/def/0.html

>>> 2 ** 38

274877906944L

>>> 

 

或者:

>>> 1 << 38

274877906944L

>>> 

 

或者:

>>> pow(2, 38)

274877906944L

>>> 

###################################################

C++版本:

#include <stdio.h> #include <math.h> int main(void) { double a = 2.0; for(int i=2; i< 39; i++) a *= 2; printf("%.0f/n", a); // 或者如下(之所以移动两次是由于<<操作操作是对于整形的,如果一次性1<<38会溢出): float b = 1<<19; b *= 1<<19; printf("%.0f/n", b); // 或者如下: printf("%.0f", pow(2, 38)); } 

 

你可能感兴趣的:(pythonchallenge 【第0题】)