#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n = 0;
while (cin >> n)
{
int a1 = 0;
int b1 = 0;
vector<int> a;
vector<int> b;
long long resnum = 1;
for (int i = 0; i < n; ++i)
{
cin >> a1;
a.push_back(a1);
}
for (int i = 0; i < n; ++i)
{
cin >> b1;
b.push_back(b1);
}
sort(a.rbegin(), a.rend());
int flag = 0;
int a_size = (int)a.size();
int b_size = (int)b.size();
for(int i=0;i<a_size;++i)
{
int sum = 0;
for (int j=0;j<b_size;++j)
{
if (a[i] <= b[j])
{
sum++;
}
}
sum = sum - flag;
flag++;
resnum = resnum * sum;
}
cout << (resnum % 100000007);
}
}
遍历两个数组,求出所有的方案,一直显示运行超时,麻烦通过的朋友们分享下思路!感谢!
#笔试题目#