简体   繁体   English

python中的Long Long Int

[英]Long Long Int in python

I have a task to calculate a sum of very big integers.我有一个任务来计算非常大的整数的总和。 the sum could be over the limit of max value of int.总和可能超过 int 的最大值的限制。 I'd like to use long long int type like in c to prevent this.我想在 c 中使用 long long int 类型来防止这种情况。 python is dynamic type language. python是动态类型语言。 but there must be someway to declare this long long int type.但必须有某种方式来声明这个 long long int 类型。 help me to declare long long int type in python.帮我在python中声明long long int类型。 thanks谢谢

You don't need to.你不需要。

>>> sum([
...     1243926478235632786572938657832682396538279658237956832976482375678239659782365,
...     23590237589734985720423803758031640192748372946743079324780137092704730297409327409237409237432,
... ])
23590237589734986964350281993664426765687030779425475863059795330661563273891703087477069019797

Python has arbitrary-size integers, that can become way larger than C's long long . Python 具有任意大小的整数,可以变得比 C 的long long大得多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM