#P5171. Counting Non-negative Integer Solutions to a Linear Inequality

    ID: 18409 Type: Default 1000ms 256MiB

Counting Non-negative Integer Solutions to a Linear Inequality

Counting Non-negative Integer Solutions to a Linear Inequality

Given three integers a, b, and c, count the number of non-negative integer solutions \(x, y \geq 0\) that satisfy the inequality \(ax + by \leq c\).

Note: You are required to output the total count of such solutions.

inputFormat

The input consists of a single line containing three space-separated integers: a, b, and c.

You may assume that \(a, b > 0\) and \(c \geq 0\).

outputFormat

Output a single integer, which is the number of pairs of non-negative integers \(x, y\) satisfying the inequality \(ax + by \leq c\).

sample

1 1 2
6