排列组合(9月8日更新

tech2024-07-11  66

文章目录

1.排列组合两个原理2.排列2.1.有放回2.2.无放回全排列(特殊情况) 3.组合3.1.二元3.2.多元3.3.分块取3.4.有重复组合数二项式公式

1.排列组合两个原理

A 1 A_1 A1事件 n 1 n_1 n1种方法, A 2 A_2 A2事件 n 2 n_2 n2种方法。

乘法原理:先进行 A 1 A_1 A1事件在进行 A 2 A_2 A2事件共有 n 1 × n 2 n_1\times n_2 n1×n2种方法 #mermaid-svg-38lc6okwVLbbshcR .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-38lc6okwVLbbshcR .label text{fill:#333}#mermaid-svg-38lc6okwVLbbshcR .node rect,#mermaid-svg-38lc6okwVLbbshcR .node circle,#mermaid-svg-38lc6okwVLbbshcR .node ellipse,#mermaid-svg-38lc6okwVLbbshcR .node polygon,#mermaid-svg-38lc6okwVLbbshcR .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-38lc6okwVLbbshcR .node .label{text-align:center;fill:#333}#mermaid-svg-38lc6okwVLbbshcR .node.clickable{cursor:pointer}#mermaid-svg-38lc6okwVLbbshcR .arrowheadPath{fill:#333}#mermaid-svg-38lc6okwVLbbshcR .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-38lc6okwVLbbshcR .flowchart-link{stroke:#333;fill:none}#mermaid-svg-38lc6okwVLbbshcR .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-38lc6okwVLbbshcR .edgeLabel rect{opacity:0.9}#mermaid-svg-38lc6okwVLbbshcR .edgeLabel span{color:#333}#mermaid-svg-38lc6okwVLbbshcR .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-38lc6okwVLbbshcR .cluster text{fill:#333}#mermaid-svg-38lc6okwVLbbshcR div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-38lc6okwVLbbshcR .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-38lc6okwVLbbshcR text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-38lc6okwVLbbshcR .actor-line{stroke:grey}#mermaid-svg-38lc6okwVLbbshcR .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-38lc6okwVLbbshcR .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-38lc6okwVLbbshcR #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-38lc6okwVLbbshcR .sequenceNumber{fill:#fff}#mermaid-svg-38lc6okwVLbbshcR #sequencenumber{fill:#333}#mermaid-svg-38lc6okwVLbbshcR #crosshead path{fill:#333;stroke:#333}#mermaid-svg-38lc6okwVLbbshcR .messageText{fill:#333;stroke:#333}#mermaid-svg-38lc6okwVLbbshcR .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-38lc6okwVLbbshcR .labelText,#mermaid-svg-38lc6okwVLbbshcR .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-38lc6okwVLbbshcR .loopText,#mermaid-svg-38lc6okwVLbbshcR .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-38lc6okwVLbbshcR .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-38lc6okwVLbbshcR .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-38lc6okwVLbbshcR .noteText,#mermaid-svg-38lc6okwVLbbshcR .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-38lc6okwVLbbshcR .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-38lc6okwVLbbshcR .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-38lc6okwVLbbshcR .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-38lc6okwVLbbshcR .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-38lc6okwVLbbshcR .section{stroke:none;opacity:0.2}#mermaid-svg-38lc6okwVLbbshcR .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-38lc6okwVLbbshcR .section2{fill:#fff400}#mermaid-svg-38lc6okwVLbbshcR .section1,#mermaid-svg-38lc6okwVLbbshcR .section3{fill:#fff;opacity:0.2}#mermaid-svg-38lc6okwVLbbshcR .sectionTitle0{fill:#333}#mermaid-svg-38lc6okwVLbbshcR .sectionTitle1{fill:#333}#mermaid-svg-38lc6okwVLbbshcR .sectionTitle2{fill:#333}#mermaid-svg-38lc6okwVLbbshcR .sectionTitle3{fill:#333}#mermaid-svg-38lc6okwVLbbshcR .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-38lc6okwVLbbshcR .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-38lc6okwVLbbshcR .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-38lc6okwVLbbshcR .grid path{stroke-width:0}#mermaid-svg-38lc6okwVLbbshcR .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-38lc6okwVLbbshcR .task{stroke-width:2}#mermaid-svg-38lc6okwVLbbshcR .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-38lc6okwVLbbshcR .taskText:not([font-size]){font-size:11px}#mermaid-svg-38lc6okwVLbbshcR .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-38lc6okwVLbbshcR .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-38lc6okwVLbbshcR .task.clickable{cursor:pointer}#mermaid-svg-38lc6okwVLbbshcR .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-38lc6okwVLbbshcR .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-38lc6okwVLbbshcR .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-38lc6okwVLbbshcR .taskText0,#mermaid-svg-38lc6okwVLbbshcR .taskText1,#mermaid-svg-38lc6okwVLbbshcR .taskText2,#mermaid-svg-38lc6okwVLbbshcR .taskText3{fill:#fff}#mermaid-svg-38lc6okwVLbbshcR .task0,#mermaid-svg-38lc6okwVLbbshcR .task1,#mermaid-svg-38lc6okwVLbbshcR .task2,#mermaid-svg-38lc6okwVLbbshcR .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-38lc6okwVLbbshcR .taskTextOutside0,#mermaid-svg-38lc6okwVLbbshcR .taskTextOutside2{fill:#000}#mermaid-svg-38lc6okwVLbbshcR .taskTextOutside1,#mermaid-svg-38lc6okwVLbbshcR .taskTextOutside3{fill:#000}#mermaid-svg-38lc6okwVLbbshcR .active0,#mermaid-svg-38lc6okwVLbbshcR .active1,#mermaid-svg-38lc6okwVLbbshcR .active2,#mermaid-svg-38lc6okwVLbbshcR .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-38lc6okwVLbbshcR .activeText0,#mermaid-svg-38lc6okwVLbbshcR .activeText1,#mermaid-svg-38lc6okwVLbbshcR .activeText2,#mermaid-svg-38lc6okwVLbbshcR .activeText3{fill:#000 !important}#mermaid-svg-38lc6okwVLbbshcR .done0,#mermaid-svg-38lc6okwVLbbshcR .done1,#mermaid-svg-38lc6okwVLbbshcR .done2,#mermaid-svg-38lc6okwVLbbshcR .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-38lc6okwVLbbshcR .doneText0,#mermaid-svg-38lc6okwVLbbshcR .doneText1,#mermaid-svg-38lc6okwVLbbshcR .doneText2,#mermaid-svg-38lc6okwVLbbshcR .doneText3{fill:#000 !important}#mermaid-svg-38lc6okwVLbbshcR .crit0,#mermaid-svg-38lc6okwVLbbshcR .crit1,#mermaid-svg-38lc6okwVLbbshcR .crit2,#mermaid-svg-38lc6okwVLbbshcR .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-38lc6okwVLbbshcR .activeCrit0,#mermaid-svg-38lc6okwVLbbshcR .activeCrit1,#mermaid-svg-38lc6okwVLbbshcR .activeCrit2,#mermaid-svg-38lc6okwVLbbshcR .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-38lc6okwVLbbshcR .doneCrit0,#mermaid-svg-38lc6okwVLbbshcR .doneCrit1,#mermaid-svg-38lc6okwVLbbshcR .doneCrit2,#mermaid-svg-38lc6okwVLbbshcR .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-38lc6okwVLbbshcR .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-38lc6okwVLbbshcR .milestoneText{font-style:italic}#mermaid-svg-38lc6okwVLbbshcR .doneCritText0,#mermaid-svg-38lc6okwVLbbshcR .doneCritText1,#mermaid-svg-38lc6okwVLbbshcR .doneCritText2,#mermaid-svg-38lc6okwVLbbshcR .doneCritText3{fill:#000 !important}#mermaid-svg-38lc6okwVLbbshcR .activeCritText0,#mermaid-svg-38lc6okwVLbbshcR .activeCritText1,#mermaid-svg-38lc6okwVLbbshcR .activeCritText2,#mermaid-svg-38lc6okwVLbbshcR .activeCritText3{fill:#000 !important}#mermaid-svg-38lc6okwVLbbshcR .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-38lc6okwVLbbshcR g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-38lc6okwVLbbshcR g.classGroup text .title{font-weight:bolder}#mermaid-svg-38lc6okwVLbbshcR g.clickable{cursor:pointer}#mermaid-svg-38lc6okwVLbbshcR g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-38lc6okwVLbbshcR g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-38lc6okwVLbbshcR .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-38lc6okwVLbbshcR .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-38lc6okwVLbbshcR .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-38lc6okwVLbbshcR .dashed-line{stroke-dasharray:3}#mermaid-svg-38lc6okwVLbbshcR #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-38lc6okwVLbbshcR #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-38lc6okwVLbbshcR #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-38lc6okwVLbbshcR #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-38lc6okwVLbbshcR #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-38lc6okwVLbbshcR #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-38lc6okwVLbbshcR #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-38lc6okwVLbbshcR #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-38lc6okwVLbbshcR .commit-id,#mermaid-svg-38lc6okwVLbbshcR .commit-msg,#mermaid-svg-38lc6okwVLbbshcR .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-38lc6okwVLbbshcR .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-38lc6okwVLbbshcR .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-38lc6okwVLbbshcR g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-38lc6okwVLbbshcR g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-38lc6okwVLbbshcR g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-38lc6okwVLbbshcR g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-38lc6okwVLbbshcR g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-38lc6okwVLbbshcR g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-38lc6okwVLbbshcR .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-38lc6okwVLbbshcR .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-38lc6okwVLbbshcR .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-38lc6okwVLbbshcR .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-38lc6okwVLbbshcR .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-38lc6okwVLbbshcR .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-38lc6okwVLbbshcR .edgeLabel text{fill:#333}#mermaid-svg-38lc6okwVLbbshcR .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-38lc6okwVLbbshcR .node circle.state-start{fill:black;stroke:black}#mermaid-svg-38lc6okwVLbbshcR .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-38lc6okwVLbbshcR #statediagram-barbEnd{fill:#9370db}#mermaid-svg-38lc6okwVLbbshcR .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-38lc6okwVLbbshcR .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-38lc6okwVLbbshcR .statediagram-state .divider{stroke:#9370db}#mermaid-svg-38lc6okwVLbbshcR .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-38lc6okwVLbbshcR .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-38lc6okwVLbbshcR .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-38lc6okwVLbbshcR .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-38lc6okwVLbbshcR .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-38lc6okwVLbbshcR .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-38lc6okwVLbbshcR .note-edge{stroke-dasharray:5}#mermaid-svg-38lc6okwVLbbshcR .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-38lc6okwVLbbshcR .error-icon{fill:#522}#mermaid-svg-38lc6okwVLbbshcR .error-text{fill:#522;stroke:#522}#mermaid-svg-38lc6okwVLbbshcR .edge-thickness-normal{stroke-width:2px}#mermaid-svg-38lc6okwVLbbshcR .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-38lc6okwVLbbshcR .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-38lc6okwVLbbshcR .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-38lc6okwVLbbshcR .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-38lc6okwVLbbshcR .marker{fill:#333}#mermaid-svg-38lc6okwVLbbshcR .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;} #mermaid-svg-38lc6okwVLbbshcR { color: rgba(0, 0, 0, 0.75); font: ; } 开始 A1 A2 结束 加法原理: A 1 A_1 A1事件和 A 2 A_2 A2事件是并行的,方法共有 n 1 + n 2 n_1+n_2 n1+n2种 #mermaid-svg-PPKoyG0EIuSXt2QC .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .label text{fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .node rect,#mermaid-svg-PPKoyG0EIuSXt2QC .node circle,#mermaid-svg-PPKoyG0EIuSXt2QC .node ellipse,#mermaid-svg-PPKoyG0EIuSXt2QC .node polygon,#mermaid-svg-PPKoyG0EIuSXt2QC .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-PPKoyG0EIuSXt2QC .node .label{text-align:center;fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .node.clickable{cursor:pointer}#mermaid-svg-PPKoyG0EIuSXt2QC .arrowheadPath{fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-PPKoyG0EIuSXt2QC .flowchart-link{stroke:#333;fill:none}#mermaid-svg-PPKoyG0EIuSXt2QC .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-PPKoyG0EIuSXt2QC .edgeLabel rect{opacity:0.9}#mermaid-svg-PPKoyG0EIuSXt2QC .edgeLabel span{color:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-PPKoyG0EIuSXt2QC .cluster text{fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-PPKoyG0EIuSXt2QC .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-PPKoyG0EIuSXt2QC text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-PPKoyG0EIuSXt2QC .actor-line{stroke:grey}#mermaid-svg-PPKoyG0EIuSXt2QC .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-PPKoyG0EIuSXt2QC #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .sequenceNumber{fill:#fff}#mermaid-svg-PPKoyG0EIuSXt2QC #sequencenumber{fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC #crosshead path{fill:#333;stroke:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .messageText{fill:#333;stroke:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-PPKoyG0EIuSXt2QC .labelText,#mermaid-svg-PPKoyG0EIuSXt2QC .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-PPKoyG0EIuSXt2QC .loopText,#mermaid-svg-PPKoyG0EIuSXt2QC .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-PPKoyG0EIuSXt2QC .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-PPKoyG0EIuSXt2QC .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-PPKoyG0EIuSXt2QC .noteText,#mermaid-svg-PPKoyG0EIuSXt2QC .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-PPKoyG0EIuSXt2QC .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-PPKoyG0EIuSXt2QC .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-PPKoyG0EIuSXt2QC .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-PPKoyG0EIuSXt2QC .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-PPKoyG0EIuSXt2QC .section{stroke:none;opacity:0.2}#mermaid-svg-PPKoyG0EIuSXt2QC .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-PPKoyG0EIuSXt2QC .section2{fill:#fff400}#mermaid-svg-PPKoyG0EIuSXt2QC .section1,#mermaid-svg-PPKoyG0EIuSXt2QC .section3{fill:#fff;opacity:0.2}#mermaid-svg-PPKoyG0EIuSXt2QC .sectionTitle0{fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .sectionTitle1{fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .sectionTitle2{fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .sectionTitle3{fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-PPKoyG0EIuSXt2QC .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-PPKoyG0EIuSXt2QC .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-PPKoyG0EIuSXt2QC .grid path{stroke-width:0}#mermaid-svg-PPKoyG0EIuSXt2QC .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-PPKoyG0EIuSXt2QC .task{stroke-width:2}#mermaid-svg-PPKoyG0EIuSXt2QC .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-PPKoyG0EIuSXt2QC .taskText:not([font-size]){font-size:11px}#mermaid-svg-PPKoyG0EIuSXt2QC .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-PPKoyG0EIuSXt2QC .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-PPKoyG0EIuSXt2QC .task.clickable{cursor:pointer}#mermaid-svg-PPKoyG0EIuSXt2QC .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-PPKoyG0EIuSXt2QC .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-PPKoyG0EIuSXt2QC .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-PPKoyG0EIuSXt2QC .taskText0,#mermaid-svg-PPKoyG0EIuSXt2QC .taskText1,#mermaid-svg-PPKoyG0EIuSXt2QC .taskText2,#mermaid-svg-PPKoyG0EIuSXt2QC .taskText3{fill:#fff}#mermaid-svg-PPKoyG0EIuSXt2QC .task0,#mermaid-svg-PPKoyG0EIuSXt2QC .task1,#mermaid-svg-PPKoyG0EIuSXt2QC .task2,#mermaid-svg-PPKoyG0EIuSXt2QC .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-PPKoyG0EIuSXt2QC .taskTextOutside0,#mermaid-svg-PPKoyG0EIuSXt2QC .taskTextOutside2{fill:#000}#mermaid-svg-PPKoyG0EIuSXt2QC .taskTextOutside1,#mermaid-svg-PPKoyG0EIuSXt2QC .taskTextOutside3{fill:#000}#mermaid-svg-PPKoyG0EIuSXt2QC .active0,#mermaid-svg-PPKoyG0EIuSXt2QC .active1,#mermaid-svg-PPKoyG0EIuSXt2QC .active2,#mermaid-svg-PPKoyG0EIuSXt2QC .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-PPKoyG0EIuSXt2QC .activeText0,#mermaid-svg-PPKoyG0EIuSXt2QC .activeText1,#mermaid-svg-PPKoyG0EIuSXt2QC .activeText2,#mermaid-svg-PPKoyG0EIuSXt2QC .activeText3{fill:#000 !important}#mermaid-svg-PPKoyG0EIuSXt2QC .done0,#mermaid-svg-PPKoyG0EIuSXt2QC .done1,#mermaid-svg-PPKoyG0EIuSXt2QC .done2,#mermaid-svg-PPKoyG0EIuSXt2QC .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-PPKoyG0EIuSXt2QC .doneText0,#mermaid-svg-PPKoyG0EIuSXt2QC .doneText1,#mermaid-svg-PPKoyG0EIuSXt2QC .doneText2,#mermaid-svg-PPKoyG0EIuSXt2QC .doneText3{fill:#000 !important}#mermaid-svg-PPKoyG0EIuSXt2QC .crit0,#mermaid-svg-PPKoyG0EIuSXt2QC .crit1,#mermaid-svg-PPKoyG0EIuSXt2QC .crit2,#mermaid-svg-PPKoyG0EIuSXt2QC .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-PPKoyG0EIuSXt2QC .activeCrit0,#mermaid-svg-PPKoyG0EIuSXt2QC .activeCrit1,#mermaid-svg-PPKoyG0EIuSXt2QC .activeCrit2,#mermaid-svg-PPKoyG0EIuSXt2QC .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-PPKoyG0EIuSXt2QC .doneCrit0,#mermaid-svg-PPKoyG0EIuSXt2QC .doneCrit1,#mermaid-svg-PPKoyG0EIuSXt2QC .doneCrit2,#mermaid-svg-PPKoyG0EIuSXt2QC .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-PPKoyG0EIuSXt2QC .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-PPKoyG0EIuSXt2QC .milestoneText{font-style:italic}#mermaid-svg-PPKoyG0EIuSXt2QC .doneCritText0,#mermaid-svg-PPKoyG0EIuSXt2QC .doneCritText1,#mermaid-svg-PPKoyG0EIuSXt2QC .doneCritText2,#mermaid-svg-PPKoyG0EIuSXt2QC .doneCritText3{fill:#000 !important}#mermaid-svg-PPKoyG0EIuSXt2QC .activeCritText0,#mermaid-svg-PPKoyG0EIuSXt2QC .activeCritText1,#mermaid-svg-PPKoyG0EIuSXt2QC .activeCritText2,#mermaid-svg-PPKoyG0EIuSXt2QC .activeCritText3{fill:#000 !important}#mermaid-svg-PPKoyG0EIuSXt2QC .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-PPKoyG0EIuSXt2QC g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-PPKoyG0EIuSXt2QC g.classGroup text .title{font-weight:bolder}#mermaid-svg-PPKoyG0EIuSXt2QC g.clickable{cursor:pointer}#mermaid-svg-PPKoyG0EIuSXt2QC g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-PPKoyG0EIuSXt2QC g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-PPKoyG0EIuSXt2QC .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-PPKoyG0EIuSXt2QC .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-PPKoyG0EIuSXt2QC .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-PPKoyG0EIuSXt2QC .dashed-line{stroke-dasharray:3}#mermaid-svg-PPKoyG0EIuSXt2QC #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-PPKoyG0EIuSXt2QC #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-PPKoyG0EIuSXt2QC #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-PPKoyG0EIuSXt2QC #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-PPKoyG0EIuSXt2QC #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-PPKoyG0EIuSXt2QC #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-PPKoyG0EIuSXt2QC #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-PPKoyG0EIuSXt2QC #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-PPKoyG0EIuSXt2QC .commit-id,#mermaid-svg-PPKoyG0EIuSXt2QC .commit-msg,#mermaid-svg-PPKoyG0EIuSXt2QC .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-PPKoyG0EIuSXt2QC .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-PPKoyG0EIuSXt2QC .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-PPKoyG0EIuSXt2QC g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-PPKoyG0EIuSXt2QC g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-PPKoyG0EIuSXt2QC g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-PPKoyG0EIuSXt2QC g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-PPKoyG0EIuSXt2QC g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-PPKoyG0EIuSXt2QC .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-PPKoyG0EIuSXt2QC .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-PPKoyG0EIuSXt2QC .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-PPKoyG0EIuSXt2QC .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-PPKoyG0EIuSXt2QC .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-PPKoyG0EIuSXt2QC .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-PPKoyG0EIuSXt2QC .edgeLabel text{fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-PPKoyG0EIuSXt2QC .node circle.state-start{fill:black;stroke:black}#mermaid-svg-PPKoyG0EIuSXt2QC .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-PPKoyG0EIuSXt2QC #statediagram-barbEnd{fill:#9370db}#mermaid-svg-PPKoyG0EIuSXt2QC .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-PPKoyG0EIuSXt2QC .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-PPKoyG0EIuSXt2QC .statediagram-state .divider{stroke:#9370db}#mermaid-svg-PPKoyG0EIuSXt2QC .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-PPKoyG0EIuSXt2QC .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-PPKoyG0EIuSXt2QC .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-PPKoyG0EIuSXt2QC .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-PPKoyG0EIuSXt2QC .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-PPKoyG0EIuSXt2QC .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-PPKoyG0EIuSXt2QC .note-edge{stroke-dasharray:5}#mermaid-svg-PPKoyG0EIuSXt2QC .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-PPKoyG0EIuSXt2QC .error-icon{fill:#522}#mermaid-svg-PPKoyG0EIuSXt2QC .error-text{fill:#522;stroke:#522}#mermaid-svg-PPKoyG0EIuSXt2QC .edge-thickness-normal{stroke-width:2px}#mermaid-svg-PPKoyG0EIuSXt2QC .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-PPKoyG0EIuSXt2QC .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-PPKoyG0EIuSXt2QC .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-PPKoyG0EIuSXt2QC .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-PPKoyG0EIuSXt2QC .marker{fill:#333}#mermaid-svg-PPKoyG0EIuSXt2QC .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;} #mermaid-svg-PPKoyG0EIuSXt2QC { color: rgba(0, 0, 0, 0.75); font: ; } 开始 A1 A2 结束

2.排列

2.1.有放回

n个元素有放回得取r个元素排列为有重复的排列–>种类有 n r n^r nr

就相当于在大小为n得序列中随机选一个元素选择r次

2.2.无放回

n个元素无放回得取r个元素排列为有重复的排列–>种类有 A n r A_n^r Anr A n r = n ( n − 1 ) ( n − 2 ) . . . ( n − r + 1 ) = n ! ( n − r ) ! A_n^r =n(n-1)(n-2)...(n-r+1)=\frac{n!}{(n-r)!} Anr=n(n1)(n2)...(nr+1)=(nr)!n! 特指:n==r,此类排列叫全排列

无放回取r次,第一次有n种选择,接下来有n-1次,以此类推,到第r此选择得时候还有n-r+1个元素,所以就有n-r+1个可能性

全排列(特殊情况)

P n = n ( n − 1 ) × ( n − 2 ) × . . . × 3 × 2 × 1 = n ! P_n=n(n-1)\times(n-2)\times...\times 3\times 2\times 1=n! Pn=n(n1)×(n2)×...×3×2×1=n!

3.组合

3.1.二元

n个不同元素抽出r个不考虑顺序成为组合,总数为: C n r = A n r r ! = n ( n − 1 ) ( n − 2 ) . . . ( n − r + 1 ) r ! = n ! ( n − r ) ! r ! C_n^r=\frac{A_n^r}{r!}=\frac{n(n-1)(n-2)...(n-r+1)}{r!}=\frac{n!}{(n-r)!r!} Cnr=r!Anr=r!n(n1)(n2)...(nr+1)=(nr)!r!n!

其实这就是常见的二项式系数,例如 ( a + b ) n = ∑ r = 0 n C n r a r b n − r (a+b)^n=\sum_{r=0}^nC_n^ra^rb^{n-r} (a+b)n=r=0nCnrarbnr

3.2.多元

3.1下一步得拓展: r 1 + r 2 + . . . + r k = n r_1+r_2+...+r_k=n r1+r2+...+rk=n,把n个元素分成k各部使得 n i = r i ( i ∈ [ 1 , k ] ) n_i=r_i(i\in[1,k]) ni=ri(i[1,k]),结果为 n ! r 1 ! r 2 ! . . . r k ! \frac{n!}{r_1!r_2!...r_k!} r1!r2!...rk!n!

计算方法: 1.分成二元时结果为 C n r C_n^r Cnr,将二元元素看作 r 1 r_1 r1 r t e a g e t 1 ( r 1 + r t e a g e t 1 = n ) r_{teaget_1}\quad (r_1+r_{teaget_1}=n) rteaget1(r1+rteaget1=n),将组合公式看成 C n r 1 C_{n}^{r1} Cnr1 C n r t e a g e t 1 C_{n}^{r_{teaget_1}} Cnrteaget1 2.第二部分 r t e a g e t 1 r_{teaget_1} rteaget1继续分成二元 r 2 r_2 r2 r t e a g e t 2 ( r 2 + r t e a g e t 2 = r t e a g e t 1 ) r_{teaget_2}\quad (r_2+r_{teaget_2}=r_{teaget_1}) rteaget2(r2+rteaget2=rteaget1)成为 C t e a g e t 1 r 2 C_{teaget_1}^{r_2} Cteaget1r2 C t e a g e t 1 t e a g e t 2 C_{teaget_1}^{{teaget_2}} Cteaget1teaget2,这时可以看成把n个元素分成三部分 C n r 1 C t e a g e t 1 r 2 = C n r 1 C n − r 1 r 2 C_{n}^{r1}C_{teaget_1}^{r_2}=C_{n}^{r_1}C_{n - r_1}^{r_2} Cnr1Cteaget1r2=Cnr1Cnr1r2,化简后得到: n ! ( n − r 1 ) ! r 1 ! × ( n − r 1 ) ! ( n − r 1 − r 2 ) ! r 2 ! = n ! r 1 ! r 2 ! r t e a g e t 2 ! \frac{n!}{(n-r_1)!r_1!}\times\frac{(n-r_1)!}{(n-r_1-r_2)!r_2!}=\frac{n!}{r_1!r_2!r_{teaget_2}!} (nr1)!r1!n!×(nr1r2)!r2!(nr1)!=r1!r2!rteaget2!n!,把 r t e a g e t 2 r_{teaget_2} rteaget2看成 r 3 r_3 r3可将最终三元答案记为 n ! r 1 ! r 2 ! r 3 ! \frac{n!}{r_1!r_2!r_3!} r1!r2!r3!n! 3.不严格的数学归纳一下,答案就出来了…(这里公式难打所以我们先这样做,规范化证明以后放出)

3.3.分块取

r 1 + r 2 + . . . + r k = r r_1+r_2+...+r_k=r r1+r2+...+rk=r,把n个元素分成k各部使得 ∑ i = 1 k n i = n \sum_{i=1}^k n_i=n i=1kni=n,需要取得r个元素,且要从 n i n_i ni中取得 r i r_i ri个,

简化思想,分开拿 直接每块拿一个照写 答案为: ∏ i = 1 k C n i r i \prod^{k}_{i=1} C_{n_i}^{r_i} i=1kCniri

3.4.有重复组合数

n个元素有重复的取r个,答案为: C n + r − 1 r C_{n+r-1}^r Cn+r1r

C n 1 C_n^1 Cn1看做有重复的取一个 C n + 1 2 C_{n+1}^2 Cn+12就可以类推成有重复的拿两个,因为重复导致可以看作将n个中随机拿出一个复制一次然后放进去一次抽去两个 以此类推 最后答案就是上面的答案了

二项式公式

0 ! = 1 0!=1 0!=1 C n k = C n n − k C_n^k=C_n^{n-k} Cnk=Cnnk ( 1 + x ) n = ∑ r = 0 n C n r x r (1+x)^n =\sum_{r=0}^nC^r_nx^r (1+x)n=r=0nCnrxr,上式x=1时, ∑ r = 0 n C n r = 2 n \sum_{r=0}^nC^r_n=2^n r=0nCnr=2n C a 0 C b n + C a 1 C b n − 1 + . . + C a n C b 0 = C a + b n C_a^0C_b^n+C_a^1C_b^{n-1}+..+C_a^nC_b^0=C_{a+b}^n Ca0Cbn+Ca1Cbn1+..+CanCb0=Ca+bn 证明挖坑 改日更新

最新回复(0)