Concurrent Lines Solution | CodeChef Problem Solution 2022
While playing in the plains, Chef found a point with coordinates .
Chef is interested in finding the number of straight lines passing through the point such that their intercepts on both axes are positive integers.
Input Format
- First and only line of input contains two integers and - the coordinates of the point .
Output Format
- For each test case, print an integer - the number of lines satisfying the given conditions.
Constraints
Sample Input 1
3 2
Sample Output 1
4
Explanation
There are lines satisfying all the conditions. These lines are:
Sample Input 2
1 2
Sample Output 2
2
Explanation
There are such lines, which are :
Sample Input 3
28 206
Sample Output 3
16
Explanation
There are such lines.
No comments:
Post a Comment