Text-editing programs frequently need to find all occurrences of a pattern in the text. Efficient algorithms for this problem - called “String Matching” - can greatly aid the responsiveness of the text-editing program. Among their many other applications, string-matching algorithms search for particular patterns in DNA sequences. Internet search engines also use them to find Web pages relevant to queries.
There are p variables, ecah one has a float value. And there are g guesses, ecah one is combined with the sum of variables and a comparison with a float value. Judger if the expression is correct.
What is the probability of win of each people.
Using map save the values of the variables, calculating the expression and comparing.
There are n people play the Rock-Paper-Scissors game.
What is the probability of of each people win the game.
Calculate as the problem said: count the times of each people win and lose (w and l), and the probability is w/(w +l)
If w and l are equal to zero, then output ‘-‘.
There is one n-peg Hanoi Tower, we will put the balls (id from 1) on it. The rule is that, each time from the first page, and check if the sum of the last ball id on the peg and the new ball id is a square number. If not, the next peg will be selected and check again, until it succeeds or gets new null pegs.
So, which is the biggest number can be put on the n-peg Hanoi Tower.
Simulation as the problem and when there are not enough pegs, it comes to over.