#include #include int getrand(int min, int max) { return min + (int)(rand() * (max - min + 1.0) / (1.0 + RAND_MAX)); } void swap(int *a, int *b) { int tmp = *a; *a = *b; *b = tmp; } void shuffle(int *d, int size) { int tmp1 = getrand(0, size - 1); int tmp2 = getrand(0, size - 1); swap(&d[tmp1], &d[tmp2]); } int main() { int n; scanf("%d", &n); int a[4], b[4]; int i, j; for (i = 0; i < n; i++) scanf("%d", &a[i]); for (i = 0; i < n; i++) scanf("%d", &b[i]); int cnta = 0, num = 300; for (i = 0; i < num; i++) { shuffle(a, n); shuffle(b, n); int cnt = 0; for (j = 0; j < n; j++) { if (a[j] > b[j]) cnt++; } if (cnt > n / 2) cnta++; } printf("%.3lf\n", (double)cnta / num); return 0; }