QFNU-ACM 2020.4.5 Individual - up title reports

 

 

The meaning of problems: there are n boys, m girls, boys selected from no less than four boys, girls selected less than a girl, t make up for the number of teams asked several possible combinations?

Thinking: permutations problem, the number of combinations and Triangle one correspondence, according to Pascal's triangle results

Code:

#include <iostream>
using namespace std;
typedef long long LL;
 
The Y LL [ 70 ] [ 70 ];
 // configured Pascal's triangle 
void the init () {
     for ( int I = 0 ; I <= 30 ; I ++ ) {
        Y[i][0]=1;
        for(int j = 1; j <= i; j++) {
            Y[i][j] = Y[i-1][j-1] + Y[i-1][j];
        }
    }
}
int main () {
    init();
    int n, m, t;
    cin >> n >> m >> t;
    LL res = 0;
    for(int i = 4; i < t; i++) {
        res += Y[n][i] * Y[m][t-i];
    }
    cout << res << endl;
    return 0;
}

 

Guess you like

Origin www.cnblogs.com/ZhengQC/p/12637925.html