#K12636. Turning Coins to Heads
Turning Coins to Heads
Turning Coins to Heads
You are given n coins and an array of flipping limits. For each coin i, you can flip it at most a certain number of times. However, to be able to ensure that coin i eventually shows heads, its flipping limit must be at least 1, i.e., it must satisfy \(flipping\_limits[i] \geq 1\).
Your task is to determine if it is possible for all coins to show heads. If every coin has a flipping limit of at least 1, print "YES"; otherwise, print "NO".
Note: Input is taken from standard input and output is printed to standard output.
inputFormat
The input consists of two lines.
- The first line contains an integer n, the number of coins.
- The second line contains n space-separated integers, representing the flipping limits for each coin.
outputFormat
Output a single line containing "YES" if it is possible to make all coins show heads, or "NO" otherwise.
## sample4
3 2 1 2
YES