Pro.ID22139 TitleEnd this painful contest with a simple problem Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22139 AC2 Submit2 Ratio100.00% 时间&空间限制描述Building 132, Room 605 was a strange dorm in south campus. All guys lived in it are gluttonous and lazy. The laziest two guys are Oper and Nicholas. They are too lazy to go to dining hall to have a meal, so they often called take-away. But as they lived on the sixth floor, nobody was willing to go downstairs to get the take-away. Therefore, they came up with a solution to solve this problem. They take two decks of cards, each deck with same number of cards. Every card has a number on it, which may be different from others. At the beginning, they each selects a deck of cards for himself, and their scores are both 0, Each operates his cards as follows: He randomly selects a card, adds its number to his score, puts it back and shuffles the cards. After N repeats, the one with higher score wins. The loser has to go downstairs for the take-away. Given the number on each card they own and N, you're asked to figure out the probability that Oper wins. 输入The first line contains an integer T, which is the number of test cases. For each test case, there will be 4 lines. The first line contains an integer M, which is the number of each deck of cards ( 1 ≤ M ≤ 100 ). The second line contains M positive integers which describe the number on every card Oper owns. The third line contains M positive integers which describe the number on every card Nicholas owns. These numbers will not exceed 50. The last line contains an integer N, which is the number of cards they randomly select respectively ( 1 ≤ N ≤ 50 ). 输出Description Building 132, Room 605 was a strange dorm in south campus. All guys lived in it are gluttonous and lazy. The laziest two guys are Oper and Nicholas. They are too lazy to go to dining hall to have a meal, so they often called take-away. But as they lived on the sixth floor, nobody was willing to go downstairs to get the take-away. Therefore, they came up with a solution to solve this problem. They take two decks of cards, each deck with same number of cards. Every card has a number on it, which may be different from others. At the beginning, they each selects a deck of cards for himself, and their scores are both 0, Each operates his cards as follows: He randomly selects a card, adds its number to his score, puts it back and shuffles the cards. After N repeats, the one with higher score wins. The loser has to go downstairs for the take-away. Given the number on each card they own and N, you're asked to figure out the probability that Oper wins. Input The first line contains an integer T, which is the number of test cases. For each test case, there will be 4 lines. The first line contains an integer M, which is the number of each deck of cards ( 1 ≤ M ≤ 100 ). The second line contains M positive integers which describe the number on every card Oper owns. The third line contains M positive integers which describe the number on every card Nicholas owns. These numbers will not exceed 50. The last line contains an integer N, which is the number of cards they randomly select respectively ( 1 ≤ N ≤ 50 ). Output For each test case, output a line contains the probability Oper wins. Round the numbers in the output to 6 digits after decimal point. Sample Input 1 Sample Output 0.620092 Source 样例输入1 样例输出0.620092 作者 |