|
||||||||||
Crazy TypewriterTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 590 Accepted Submission(s): 176 Problem Description There was a crazy typewriter before. When the writer is not very sober, it would type characters randomly, one per second, the possiblities of characters may differ. The protagonist in this problem wants to tell acmers some secrets, of course, by the typewriter. There had been several opportunities, but the protagonist let them sliped. Now, another opportunity came, the writer started a new paragraph. The protagonist found that he could set the possiblities of each character in happy astonishment. After the possiblities had been set, he wanted to know the exception of time at least the writer need to be mind-absent if any secret was typed out. fewovigwnierfbiwfioeifaorfwarobahbgssjqmdowj Input There are several cases, no more than 15. The first line of each case contains an integer n, no more than 15, indicating the number of secrets. The second line contains 26 real numbers, indicating the set possibilities of 'a'-'z', respectively, the sum would be 1.0 . Then n lines, each contains a secret, no longer than 15, which is made up by lowercase letters 'a'-'z'. Output A single line contains the expectation of time for each caseŁ¬ in seconds with six decimal, if the exception doesn't exist, output "Infinity" Sample Input
Sample Output
Source | ||||||||||
|