#C2600. Mixing Chemical Solutions

    ID: 45935 Type: Default 1000ms 256MiB

Mixing Chemical Solutions

Mixing Chemical Solutions

You are given a total volume V (in liters) and a target concentration C (in percent) for a chemical solution. You have three available solutions with fixed concentrations of 10%, 20%, and 30%, respectively. Your task is to determine nonnegative integer volumes (in liters) for solutions A, B, and C such that:

\(a + b + c = V\)

\(10a + 20b + 30c = C \cdot V\)

If the target concentration matches one of the given concentrations (10, 20, or 30), then the answer is trivial. Otherwise, you must find any triplet \((a, b, c)\) satisfying the above conditions.

Note: It is guaranteed that V will be a whole number provided as a float (for example, 100.0) and that a valid solution exists for the given test inputs.

inputFormat

The input is provided via stdin as two space-separated numbers: V (the total volume in liters) and C (the target concentration in percent).

For example:

100.0 10.0

outputFormat

Output three space-separated integers corresponding to the volumes of solutions A, B, and C used, printed to stdout.

For example:

100 0 0
## sample
100.0 10.0
100 0 0