#P11701. Counting Natural Number Pairs with a Given Square Difference

    ID: 13792 Type: Default 1000ms 256MiB

Counting Natural Number Pairs with a Given Square Difference

Counting Natural Number Pairs with a Given Square Difference

Given three integers \(l\), \(r\), and \(d\), count the number of natural number pairs \((x, y)\) satisfying:

  • \(l \le y^2 < x^2 \le r\)
  • \(x^2 - y^2 = d\)

Here, \(x\) and \(y\) are natural numbers (positive integers). The output should be the total count of such pairs.

inputFormat

The input consists of a single line containing three space-separated integers: \(l\), \(r\), and \(d\).

outputFormat

Output a single integer representing the number of pairs \((x,y)\) that satisfy the conditions.

sample

1 100 24
1