在做一个习题,要求如下:
我在数字比较小时已经解决了这个问题,可是当整数达到30位时,long long int 已经不能存储,请问有什么解决方法吗?
我自己写的程序详见 https://github.com/huyang7211...
欢迎大家一起来刷题
ringa_lee
Using character array processing can increase flexibility;eg:
char chArr[32] = "12345678912345678912345678912345";//你可以使用比较大的长度 int i = 0, sum = 0; for(; i < 32; i++) { sum += chArr[i] - '0'; }
用char array
You don’t actually need to store the number itself...
If it were me, I would treat this number as a string.
Using character array processing can increase flexibility;
eg:
用char array
You don’t actually need to store the number itself...
If it were me, I would treat this number as a string.