#C6770. Unique Track Playlists
Unique Track Playlists
Unique Track Playlists
You are given a list of tracks, where each track is represented by its duration in seconds, and a target duration. Your task is to determine the number of unique ways to select a subset of tracks (each track may be used at most once) such that their total duration exactly matches the target duration.
Note that the order of tracks in a playlist does not matter, so two playlists with the same set of tracks in different order are considered the same.
The problem can be formulated mathematically as: Find the number of subsets \( S \) of the set of tracks such that \[ \sum_{i \in S} t_i = T, \] where \( t_i \) is the duration of the \( i \)-th track and \( T \) is the target duration.
inputFormat
The first line of input contains two integers \( n \) and \( T \), where \( n \) is the number of tracks, and \( T \) is the target duration.
The second line contains \( n \) integers representing the duration (in seconds) of each track. If \( n=0 \), the second line will be empty.
outputFormat
Output a single integer: the number of unique ways to choose a subset of tracks whose durations sum up to \( T \).
## sample5 10
2 3 5 8 13
2
</p>