In the permutation combination, the common partition method is used for the problem of loading the number of the non-resolved ball into the distinguishable box. Application skill of partition method in permutation and combination
Example 1. find the number of positive integer solutions to the equation.
Analysis
divide the ball into a row, the ball and the ball form 9 voids, the two partitions inserted into these voids (each empty at most one partition), the left, middle, and right three parts of the partition divided by the number of balls are x,y ,z value (e.g.). Then, the number of solutions is set up between one by one and the number of solutions (a). The actual use of partition method to solve problems, in determining the number of balls, how to insert a partition and other issues on the formation of some skills. The following examples illustrate.
Technique One: Add the number of balls with the partition method.
Example 2. The number of non-negative integer solutions for the equation.
Analysis
notice that x,y,z can be zero, so the limit in the method of solving the "every empty at most one partition" is not set up, how to do? Just add three balls and give x,y,z a ball. So the original problem is converted to the number of positive integer solutions, so the number of solutions is (a).
Reviews
In This example, the problem is converted to a typical partition method in example 1 by adding the number of balls.
Tip Two: Reduce the number of balls with the partition method:
Example 3. Place The same balls into 4 boxes with numbers 1,2,3,four respectively, requiring that the number of balls in each box be no less than the number of its numbers, The total number of methods of seeking release.
Solution 1: First in the number 1,2,3,4 four boxes respectively put 0, 1,2, 3 balls, the remaining three balls, there are 1 ways, and then the rest of the ball into 4 groups, each group at least 1 , by example 1 know method has (species).
Solution2: The first step is first in the numbering1,2,3,4In four boxes, respectively, and1,2,3,4a ball, the rest.10a ball, there1The second step is to take the rest10the same ball is put in a numbered1,2,3,4In the box, by example2there are (kinds) of methods of knowing.
Reviews
two solutions are converted to the typical problem in Example 1, example 2 by reducing the number of balls .
Technique three: has inserted with the partition method successively.
Example 4. for the promotion of the party's 16 major meeting spirit, a literary and artistic group grassroots propaganda performance, the preparation of the programme table of the original 4 song and dance programs, if the relative order of these programs to maintain the same, to add two pieces of the program, then the different arrangement method how many kinds?
Analysis
Two pieces of the program were A,B. First row A program. According to a program before and after the number of song and dance programs to consider the number of methods, equivalent to 4 of the ball into two piles, by example 2 know a way. When this step is complete, there are 5 programs. Consider the number of programs before and after the B program to be added, and know the same way. Therefore, it is known by the step counting principle, and the method is common (species).
Reviews
The two partitions needed to be inserted in the subject should be inserted sequentially, so that the problem can be solved skillfully.
HDU1410
Formula derivation:
Set
The feather of maple is x, copper hydroxide is Y
X needs to be played N times to defeat Y.
Y need to hit k times to beat X.
The probability of x hitting y in a round = the probability of y hitting x = 0.5
To x win, x must be played n times, and y can be played 0 times, 1 times, 2 times ... k-1 times, and the last time of course must be X dozen, so (set y dozen I times), then a total dozen n+i times, in the first n+i-1 to select I time to let X be hit by y
So the probability of x winning =
C (n+0-1,0) *0.5^n + C (n+1-1,1) *0.5^ (n+1) + ... + c (n+i-1,i) *0.5^ (n+i) ...
The number of combinations is too large, so the logarithm method is used
<span style= "FONT-SIZE:12PX;" > #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <algorithm> #include <math.h>using namespace std; #define L __int64#define M 1005#define inf 0x3fffffffint Main () {int H1, H2, A1, a2, N, K, i;double C, Res;while (~scanf ("%d%d%d%d", &h1, &h2, &A1, &a2)) {n = (H2 + a1-1)/a1;k = (H1 + a2-1)/a2;res = POW (0.5, n); c = 0;for (i = 1; i < K; i++) {c = c + log10 (n+i-1.0)-log10 (i+0.0); res + = POW (10.0, C + (n+i) *log10 (0.5));} printf ("%.4f\n", res*100);} return 0;} </span>
The partition method in combination counting HDU 1410 PK Martial arts leader