#K82737. Determine Required Order Quantities

    ID: 36042 Type: Default 1000ms 256MiB

Determine Required Order Quantities

Determine Required Order Quantities

You are given the desired stock level (D), the current stock (C), and the threshold stock (T) for each of several products. Your task is to compute the quantity that must be ordered for each product in order to reach the desired stock level.

For each product, if the current stock is less than the threshold (C < T), then the quantity to order is computed as \(D - C\); otherwise, no order is required (i.e., the order quantity is 0).

Input: The first line contains an integer \(N\) representing the number of products. Each of the following \(N\) lines contains three space-separated integers \(D\), \(C\), and \(T\).
Output: Output \(N\) integers separated by spaces where each integer is the order quantity for the corresponding product.

inputFormat

The input consists of multiple lines:

  • The first line contains a single integer \(N\), the number of products.
  • The next \(N\) lines each contain three integers separated by spaces: \(D\) (desired stock), \(C\) (current stock), and \(T\) (threshold stock).

outputFormat

Output a single line with \(N\) integers separated by a space. Each integer represents the quantity to order for the respective product. If the current stock \(C\) is not below the threshold \(T\), output 0 for that product.

## sample
3
200 150 180
500 400 450
300 350 250
50 100 0