All we need to do is to find out a number , made of the last two digits of multiplication of given four numbers. Then If we divide by 25 then we will get which level it belongs to.
Lets say given numbers are , , , and .
It is a fact that If we divide a number by 10 we get the last digit of that number as remainder. And If we divide a number by 100 we get a number consisting of the last two digits of that number as remainder. Thus, and is our desired answer.
One drawback of this solution is, we won't be able to store the result of multiplication with int (or even long long int) data type if the given numbers are large enough.
As we know from modular arithmetic, is the same as .
Thus for this problem we can find the remainder of all four numbers after dividing by 100 and then multiply them. We again divide the result of multiplication to get the last two digits. Thus, we can avoid overflow in the multiplication step and then we determine the level of Katana with the process mentioned above.
So the solution would be: