#K15436. Distribute Tickets
Distribute Tickets
Distribute Tickets
You are given two integers n and T. The problem is to determine whether it is possible to distribute T tickets among n friends such that each friend receives a different number of tickets. In order for the distribution to be possible, the total number of tickets T must be at least the sum of the first n natural numbers, which is given by the formula: \(\frac{n(n+1)}{2}\). If \(T \geq \frac{n(n+1)}{2}\), output YES
, otherwise output NO
.
inputFormat
The input consists of a single line containing two space-separated integers: n (the number of friends) and T (the number of tickets).
outputFormat
Output a single line with YES
if it is possible to distribute the tickets as described, or NO
otherwise.
3 6
YES
</p>