#K41852. Can Water Plants?
Can Water Plants?
Can Water Plants?
Alicia is a botanist who loves to grow a variety of plants. Each plant requires a specific amount of water per day. Alicia has a limited amount of water available daily and she wants to set up an automatic watering system. However, the system must water each plant entirely, meaning that the water allocated to each plant cannot be split.
Your task is to determine, for each test case, whether the sum of all the individual water requirements equals exactly the total water available for that day. In mathematical form, given water requirements a1, a2, \dots, aN and a total water limit K, check if:
[ \sum_{i=1}^{N} a_i = K ]
If the equality holds, print YES
; otherwise, print NO
.
inputFormat
The input is read from standard input and consists of multiple test cases. The first line contains a single integer T, denoting the number of test cases. For each test case:
- The first line contains two space-separated integers N and K — where N is the number of plants and K is the total water available.
- The second line contains N space-separated integers representing the water requirements of the plants.
outputFormat
For each test case, output a single line containing either YES
if the sum of the water requirements of all plants exactly equals K, or NO
otherwise.
2
3 6
1 2 3
3 40
5 10 15
YES
NO
</p>