Task 17 Array Checksum

Back to General discussions forum

Sh_a_man     2017-07-30 17:55:40

Hello!

In this task it was possible to achieve the correct result only when using "unsigned long long". I did not think it would take such a huge importance. I almost did not decide to solve this task because of this.

Quandray     2017-07-30 18:42:34
User avatar

It does say "All input values are between 0 and 1,000,000,000 - be sure to take care of possible overflow in progress of calculations!"

If you multiply 1,000,000,000 by 113 it won't fit in a 32 bit integer, so you'll need something bigger. "long long" will do.

Sh_a_man     2017-08-01 05:38:39

Modular Calculator Problem #14 Here, unsigned long long can not cope with overflow

Quandray     2017-08-01 06:35:02
User avatar

Modular Calculator problem #14 should be solved using normal integers. Follow the link about Modular Arithmetic.

Andris Laduzans     2019-03-03 19:31:54

just put modulo after every calculation and you are good.

Please login and solve 5 problems to be able to post at forum