Eighty sevenTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)Total Submission(s): 1782 Accepted Submission(s): 562 Problem Description Mr. Fib is a mathematics teacher of a primary school. In the next lesson, he is planning to teach children how to add numbers up. Before the class, he will prepare N cards with numbers. The number on the i-th card is ai. In class, each turn he will remove no more than 3 cards and let students choose any ten cards, the sum of the numbers on which is 87. After each turn the removed cards will be put back to their position. Now, he wants to know if there is at least one solution of each turn. Can you help him? Input The first line of input contains an integer t (t≤5), the number of test cases. t test cases follow. Output For each turn of each case, output 'Yes' if there exists at least one solution, otherwise output 'No'. Sample Input 1 12 1 2 3 4 5 6 7 8 9 42 21 22 10 1 2 3 3 4 5 2 3 2 10 10 10 10 11 11 10 1 1 1 2 10 1 11 12 1 10 10 11 11 12 Sample Output No No No Yes No Yes No No Yes Yes Source 2016 ACM/ICPC Asia Regional Qingdao Online 首先先预处理所有情况 然后用bitset <90> dp[11] 进行二维背包dp dp[i][j] 为1 代表在取i个数时能加和到 j ; |
HDU5890 Eighty seven 预处理+背包 + bitset优化
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Tawn0000/article/details/82259936
猜你喜欢
转载自blog.csdn.net/Tawn0000/article/details/82259936
今日推荐
周排行