Task DescriptionDiscussion (0)

The first line of the input contains two integers N and M separated by a space character (1 <= N <= 26, 1 <= M <= 10^200). N is the number of letters in the alphabet, and M is your budget in dollars. Each of the next N lines contain one integer A(A <= N), representing the cost of writting the corresponding letter.

In the first line of the output, write a single number T mod 8192, where T is number of different words whose printing costs exactly M.

Task :: mit-indiv09-words

You are studying the cost of printing newspapers using different alphabets. For a given alphabet, you know the number of letters it contains, and the cost of printing each of the letters (in dollars). What is the number of different words that cost exactly M dollars? Since we donâ€™t know anyting about the language, you should assume that any possible combination of the letters in the alphabet is a valid word.

**INPUT:**

The first line of the input contains two integers N and M separated by a space character (1 <= N <= 26, 1 <= M <= 10^200). N is the number of letters in the alphabet, and M is your budget in dollars. Each of the next N lines contain one integer A(A <= N), representing the cost of writting the corresponding letter.

**OUTPUT:**

In the first line of the output, write a single number T mod 8192, where T is number of different words whose printing costs exactly M.

Input:

Output:

**4 1**

23

1

1

1

23

1

1

1

Output:

**3**

Submit Solution

Available Languages

Task info

Name: | mit-indiv09-words |

Time: | 1.5 sec. |

Memory: | 64 MB |

#Tests: | 10 |

AddedBy: | admin |

Task Ratings

Difficulty: | 4.1 (7 votes) |

Quality: | 4.4 (7 votes) |

Acceptance Rate

Recent Submissions

Fastest Solutions

User | Time |
---|---|

The_Philosopher | 0.131 s. |

crusader | 0.145 s. |

_qwAker_ | 0.158 s. |

senator | 0.168 s. |

ivan100sic | 0.17 s. |

Al3kSaNdaR | 0.187 s. |

frost_nova | 0.194 s. |

msantl | 0.291 s. |

halil | 0.343 s. |

Daniel93 | 0.37 s. |

Solved By