Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- const int N = 1010 , mod = 7901;
- int n , x[N] , cnt[N] , fact[N];
- int main(){
- fact[0]=1;
- for(int i=1;i<N;i++)
- fact[i]=fact[i-1]*i%mod;
- int t;
- cin>>t;
- while( t-- ){
- cin>>n;
- for(int i=0;i<n;i++){
- cin>>x[i];
- cnt[x[i]]++;
- }
- int ans=1;
- for(int i=1;i<N;i++)
- ans = ans * fact[cnt[i]] %mod;
- cout<<ans<<endl;
- for(int i=0;i<n;i++)
- cnt[x[i]]--;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement