This is the code I have typed for Big Multiplication and got correct output in IDE but it shows wrong answer when I submit what is wrong.
using namespace std;
long int m,n,xr,yr;
As the contest is now over I shall answer your question
See the question asked The digits that a single number contained where over 100000 digits so long long int is
not the correct data type for the question. The input data type should be a string or a 1-D character array.
You can do this question by using Boost Library or
Big Int library. But if you want to do it without this then:-
The question asks you to multiply the numbers and the calculate it’s remainder modulo 3
Now it is a well known fact that a number modulo 3 is equal to sum of its digits modulo 3
So for a string just calculate the sum of all int(indices) -‘0’(because int(c[i]) will contain the ascii
value of the character.
After summation of each string separately calculate it’s modulo with 3 multiply the result of the 2 string
the again calculate modulo 3 as(a * b)%3=((a%3) * (b%3))%3
I hope this helped:) Happy coding cheers!!