#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int ll; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) const int MAX_N = 10010, MAX_W = 10010, MAX_V = 10010; int N; int A[10], B[10]; int win = 0, lose = 0; //nは繰り返した回数 void dfs(int n,int win1, vector v) { //全部終わらせたとき勝ってたら if (n == N) { if (win1 > n - win1) { win++; } else { lose++; } return; } for (int i = 0; i < N; i++) { bool hantei = false; //if 記憶してある番号だったら飛ばす for (int j = 0; j < v.size(); j++) { if (v[j] == i) hantei = true; } if (hantei) continue; int tmp = win1; if (A[n] > B[i]) tmp++; vector vtmp1 = v; vtmp1.push_back(i); dfs(n + 1, tmp, vtmp1); } } int main() { cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = 0; i < N; i++) { cin >> B[i]; } vector vtmp; dfs(0, 0, vtmp); cout << float(win) / (win + lose) << endl; }