@@ -0,0 +1,1345 @@
+import java.util.Arrays;%0Aimport java.util.Scanner;%0A%0Apublic class Solution %7B%0A    public static int first(boolean%5B%5D children) %7B%0A        int i;%0A        for (i = 0; i %3C children.length; i++) %7B%0A            if (children%5Bi%5D)%0A                break;%0A        %7D%0A        return i;%0A    %7D%0A%0A    public static int picnic(boolean%5B%5D%5B%5D friends, boolean%5B%5D children) %7B%0A        int count = 0;%0A        int c = first(children);%0A%0A        if (c == children.length)%0A            return 1;%0A%0A        for (int i = 0; i %3C children.length; i++) %7B%0A            if (friends%5Bc%5D%5Bi%5D && children%5Bi%5D) %7B%0A                children%5Bc%5D = children%5Bi%5D = false;%0A                count += picnic(friends, children);%0A                children%5Bc%5D = children%5Bi%5D = true;%0A            %7D%0A        %7D%0A        return count;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner sc = new Scanner(System.in);%0A        int n = sc.nextInt();%0A        int m = sc.nextInt();%0A        boolean%5B%5D children = new boolean%5Bn%5D;%0A        Arrays.fill(children, true);%0A        boolean%5B%5D%5B%5D friends = new boolean%5Bn%5D%5Bn%5D;%0A%0A        for (int i=0; i %3C m; i++) %7B%0A            int first = sc.nextInt();%0A            int second = sc.nextInt();%0A            friends%5Bfirst%5D%5Bsecond%5D = true;%0A            friends%5Bsecond%5D%5Bfirst%5D = true;%0A        %7D%0A        int ans = picnic(friends, children);%0A        System.out.println(ans);%0A    %7D%0A%7D%0A

Create p155.java