Coding Problems & Solution ( HackerEarth: Basic Number Theory - 1)

This problem was posted by HackerEarth.

Problem Statement:

Find the answer of (ABC)%M(ABC)%M.
Input :
TThe only line of input consists of four integers A, B, C and M. The input always has C and M such that gcd(C, M)=1.
Output :
Print the answer as asked in the problem statement.
Constraints :
1A,B,C,M1091≤A,B,C,M≤109
gcd(C,M)=1gcd(C,M)=1.
Sample Input 0
2 3 4 5
Sample Output 0
2

Solution

No comments:

Post a Comment