#K46857. Discount Qualification Problem

    ID: 28069 Type: Default 1000ms 256MiB

Discount Qualification Problem

Discount Qualification Problem

You are given the number of pizzas ordered n, a list of pizza prices prices, and a minimum order amount k. The order qualifies for a discount if and only if both of the following conditions hold:

  • n > 1
  • The total sum of the prices is strictly greater than k, i.e. \(\sum_{i=1}^{n} p_i > k\).

Otherwise, the order does not qualify for a discount. Print YES if the order qualifies and NO otherwise.

inputFormat

The input is read from standard input (stdin) and consists of three lines:

  1. An integer n representing the number of pizzas.
  2. A line with n space-separated integers representing the prices of each pizza.
  3. An integer k representing the minimum order amount required for the discount.

outputFormat

Output a single line to standard output (stdout) containing either YES if the order qualifies for a discount or NO otherwise.

## sample
3
12 15 10
30
YES