Back to General discussions forum
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.
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.
Modular Calculator Problem #14 Here, unsigned long long can not cope with overflow
Modular Calculator problem #14 should be solved using normal integers. Follow the link about Modular Arithmetic.
just put modulo after every calculation and you are good.