Top Batsmen : BESTBATS

Please help, I’m getting wrong answer.
Here is my code

#include <stdlib.h>
#include <iostream>
#include <algorithm>

using namespace std;

int fact[12] = {1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800};

int nCr(int n, int r){
    return fact[n]/(fact[n-r]*fact[r]);
}

int main(){
    int t, k;
    cin >> t;
    while(t--){
        int *a = new int[11];
        int *b = new int[101];
        int *c = new int[101];
        for(int i = 0; i<101; i++){
            b[i] = 0;
            c[i] = 0;
        }
        for(int i = 0; i<11; i++){
            cin >> a[i];
            b[a[i]]++;
        }
        cin >> k;
        sort(a,a+11);
        for(int i = 10; i>=k-1; i--){
            c[a[i]]++;
        }
        int num = 1;
        for(int i = 0; i<101; i++){
            if(c[i]==b[i]){
                num *= 1;
            }
            else{
                num*=nCr(b[i],c[i]);
            }
        }
        cout << num << endl;
    }
    return 0;
}

Your code gives wrong answer for the foll test case:

1

1 1 1 1 1 1 1 1 1 1 1

7

Your output:432

Correct output:330

I think this case will be helpful to you.The error lies in this part…

 for(int i = 0; i<101; i++){
        if(c[i]==b[i]){
            num *= 1;
        }
        else{
            num*=nCr(b[i],c[i]);
        }
    }

If you have any doubts comment below.

//