Swapped Distributive Law
Time limit1sMemory limit1024 MB
Count integer triples (a, b, c) with absolute values at most N that satisfy a + bc = (a + b)(a + c).
- Level
Easy3 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Recently, Jeuti studied addition and multiplication and learned the distributive law. The distributive law means that for any three real numbers , , , the equation always holds. Jeuti then wondered whether the expression with the positions of the addition and multiplication signs swapped also holds: for any three real numbers , , , . Jeuti is still young and cannot handle large numbers, so Jeuti can only evaluate these expressions when , , are integers whose absolute values do not exceed . Count the integer pairs within this range that satisfy the swapped distributive law.
Input
The first line contains , the bound on the absolute values of , , and .
Output
Print the number of integer triples that satisfy the swapped distributive law.