[2023 Autumn Recruitment] Crazy Game Written Test AK Code and Design Question Answer Sharing

first question

Title meaning

Now you have several banknotes of various denominations in your hand, calculate how many payment methods there are for a commodity of a given value

enter description

The face value of the banknotes you own is represented by a group of numbers separated by ",", each number represents the face value of a banknote you own, the face value of the banknote
and the price of the commodity, separated by ":", ";" in front of it indicates the value of the banknote Various denominations, ";" indicates the price of the product
, such as 1, 2; 3, which means that there are 1 banknotes of 1 yuan and 1 banknote of 2 yuan, and you need to buy 3 yuan of goods

output description

Use "," to separate the different face values ​​of the same group of answers; use ";" to separate the answers of different groups

sample data

Input: 1,1; 2
Output: 1,1
Explanation: The love brother who has the only answer

Input: 1, 2, 3, 4, 5; 5
Output: 5; 1, 4; 2, 3
Explanation: Pay attention to the different ordering of multiple sets of answers, the answer has a unique solution

Supongo que te gusta

Origin blog.csdn.net/Luoxiaobaia/article/details/126329836
Recomendado
Clasificación