Any ideas about interesting problem!

Revision en1, by difask, 2015-10-27 23:38:38

Hello everyone!

Please, help me to solve this problem. I've thought about it with my friends for a long time, but we couldn't find the solution.

You're given N<50 planks with known lengths a[i]<10000. You can cut them in any amount of planks you want. Also you're given planks that you should get. Their amount M<1024, length b[i]<128. You should find maximal number of planks that you can get.

Example:
Input:
4
30 40 50 25
10
15 16 17 18 19 20 21 25 24 30
Output:
7
Explanation:
15 + 16 + 17 -> 50 (cutting 50 into 15, 16, 17, 50-15-16-17=2)
18 + 19 -> 40
20 -> 30
21 -> 25

Thanks!

P.S. I'm currently preparing for my English exam and want to improve my writing. If you notice any mistakes, please send a message or write in the comments section. Thanks!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru2 Russian difask 2015-10-27 23:40:24 216 Мелкая правка: '17 -
en1 English difask 2015-10-27 23:38:38 842 Initial revision for English translation
ru1 Russian difask 2015-10-27 20:07:52 372 Первая редакция (опубликовано)