#142. 条件判断比较整数
条件判断比较整数
Compare Integers
Background
Congcong is learning about conditional statements and needs your help to solve an interesting problem.
Problem Description
Given two integer values, return whichever value is larger. However, if the two values have the same remainder when divided by , then return the smaller value. In all cases, if the two values are the same, return . Note: the % (mod) operator computes the remainder, e.g., is .
Input Format
Input is given from standard input in the following format.
Two integers and .
Output Format
Output is printed to standard output in the following format.
An integer representing the result calculated according to the rules.
Sample
2 3
3
6 2
6
3 2
3
Sample Explanation
Sample : The remainders of and when divided by are and respectively, which are not the same. Return the larger value, . Sample : The remainders of and when divided by are and respectively, which are not the same. Return the larger value, . Sample : The remainders of and when divided by are and respectively, which are not the same. Return the larger value, .
Constraints
Time limit for each test case is second, and memory limit is KiB.