package no173; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.util.NoSuchElementException; public class Main { static IO io = new IO(); static int GETA = 20005; static int MAX = 40010; public static void main(String[] args) { int n = io.nextInt(); double[] p = io.nextDoubleArray(2); int[][] hand = new int[2][]; for(int i=0;i<2;i++) { hand[i] = io.nextIntArray(n); Arrays.sort(hand[i]); } //q[i][j] := i+1ターン目にj+1番目に小さいカードを出す確率 double[][][] q = new double[2][n][n]; for(int pl=0;pl<2;pl++) { for(int j=0;j hand[1][j] ? (hand[0][i] + hand[1][j]) : -(hand[0][i] + hand[1][j]); // System.out.println(q[0][t][i] * q[1][t][j]); int nk = k + dpoint; if (nk < 0 || nk >= MAX) { continue; } dp[t+1][nk] += dp[t][k] * q[0][t][i] * q[1][t][j]; } } } // for(int i=GETA-10;i<=GETA+10;i++) { // System.out.print(dp[t][i] + ","); // } // System.out.println(); } for(int i=GETA+1;i Integer.MAX_VALUE) { throw new NumberFormatException(); } return (int) nl; } public char nextChar() { if (!hasNext()) { throw new NoSuchElementException(); } return (char) readByte(); } public double nextDouble() { return Double.parseDouble(next());} public int[] nextIntArray(int n) { int[] a = new int[n]; for(int i=0;i