Check Congruent

Check Congruent

Easy Computer Mathematics Modular Arithmetic 30 views
Explanation Complexity

Problem Statement

Print YES if a and b are congruent mod m.

Input Format

Three integers a b m.

Output Format

YES or NO.

Example

14 2 12
YES

Constraints

m>0

Input / Output Format

Input Format
Three integers a b m.
Output Format
YES or NO.
Constraints
m>0

Examples

Input:
14 2 12
Output:
YES

Example Solution (Public)

Computer Mathematics
Normalize both and compare (a mod m) == (b mod m).

Official Solution Code

Normalize both and compare (a mod m) == (b mod m).
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.