#P3277. [SCOI2011] 飞镖
[SCOI2011] 飞镖
Description
Darts is a popular sport in Europe. The dartboard is divided into 20 sector areas labeled 1 to 20. Each sector has single, double, and triple rings; hitting a ring yields the sector value multiplied by the corresponding multiplier.
For example, hitting the triple ring of 18 scores 54 points.
In addition, at the center of the board there are the outer bull and the inner bull, worth 25 and 50 points respectively.
A common darts rule is that you must finish on a double with your last dart to win. That is, if 12 points remain, you must hit double 6 to win; hitting single 12 or triple 4 does not count.
In particular, the inner bull also counts as a double (double 25). Under these rules, the maximum score that can be finished in 3 darts is 170 (two triple 20s and finishing on the inner bull).
Now, lxhgww changes the sector values from 1–20 to 1–, and changes the outer bull to be worth points (the inner bull is twice that). lxhgww wants to know whether a total of points can be finished within 3 darts (you may use fewer than 3 darts). Likewise, the last dart must be a double (including the inner bull).
Input Format
The first line contains an integer , the number of test cases.
The second line contains 5 integers , indicating that in the first test case the board has sectors from 1 to . For subsequent test cases, the board parameter is determined by , and in the -th test case () the board has sectors from 1 to .
The third line contains 5 integers , indicating that in the first test case the outer bull is worth points. For subsequent test cases, the value is determined by , and in the -th test case () the outer bull is worth points.
The fourth line contains 5 integers , indicating that in the first test case the required total is points. For subsequent test cases, the target is determined by , and in the -th test case () the required total is points.
Output Format
Output one line containing a single integer, the number of test cases among the that are solvable.
5
1 2 2 10 20
1 3 2 15 25
2 2 5 200 170
4
Hint
For 30% of the testdata, it is guaranteed that , .
For 100% of the testdata, it is guaranteed that , .
For all testdata, it is guaranteed that .
Translated by ChatGPT 5
京公网安备 11011102002149号