#P10090. Count Divisible Sum Pairs
Count Divisible Sum Pairs
Count Divisible Sum Pairs
Given three integers \( n, a, b \), count the number of pairs \( (x, y) \) such that \( 0 \le x \le a \), \( 0 \le y \le b \), \( x+y \neq 0 \), and \( x+y \) is divisible by \( n \). In other words, find the count of pairs satisfying:
\[ 0 \le x \le a, \quad 0 \le y \le b, \quad (x, y) \neq (0, 0), \quad \text{and} \quad n \mid (x+y) \]
inputFormat
The input consists of a single line containing three integers \( n, a, b \), separated by spaces.
\( n \) is the divisor, \( a \) and \( b \) are the upper bounds for \( x \) and \( y \) respectively.
outputFormat
Output a single integer representing the number of valid pairs \( (x, y) \) that satisfy the conditions.
sample
3 3 3
5