import java.util.*;
import java.lang.*;
import java.io.*;

class Ideone {
	
    static class Child {
        
        boolean female;
        boolean florida;

        public Child(boolean female, boolean florida) {
            this.female = female;
            this.florida = female && florida;
        }
    }

    public static void main(String[] args) {
        final int FLORIDA_ONE_IN = args.length > 0 ? Integer.parseInt(args[0]) : 10;
        Random rnd = new Random();
        final Child[][] children = new Child[1000000][];
        System.out.println("Generating");
        for (int i = 0; i < children.length; i++) {
            Child[] pair = new Child[2];
            pair[0] = new Child(rnd.nextInt(2) == 0, rnd.nextInt(FLORIDA_ONE_IN) == 0);
            pair[1] = new Child(rnd.nextInt(2) == 0, rnd.nextInt(FLORIDA_ONE_IN) == 0);
            children[i] = pair;
        }
        System.out.println("Counting");
        int oneIsGirl = 0;
        int bothGirls = 0;
        int oneIsFlorida = 0;
        int oneFloridaBothGirls = 0;
        int oneIsFloridaUnique = 0;
        int oneFloridaBothGirlsUnique = 0;
        for (int i = 0; i < children.length; i++) {
            Child[] pair = children[i];
            if (pair[0].female || pair[1].female) {
                oneIsGirl++;
                if (pair[0].female && pair[1].female) {
                    bothGirls++;
                }
            }
            if (pair[0].florida || pair[1].florida) {
                oneIsFlorida++;
                oneIsFloridaUnique++;
                if (pair[0].female && pair[1].female) {
                    oneFloridaBothGirls++;
                    oneFloridaBothGirlsUnique++;
                    if (pair[0].florida && pair[1].florida) {
                        // not unique, remove from data
                        oneIsFloridaUnique--;
                        oneFloridaBothGirlsUnique--;
                    }
                }
            }
        }
        System.out.printf(">1 girl        %7d%n", oneIsGirl);
        System.out.printf("both girls     %7d%n", bothGirls);
        System.out.printf("chance         %9.2f%%%n",(100f * bothGirls) / oneIsGirl);
        System.out.printf(">1 Florida     %7d%n", oneIsFlorida);
        System.out.printf("both girls(F)  %7d%n", oneFloridaBothGirls);
        System.out.printf("chance         %9.2f%%%n",(100f * oneFloridaBothGirls) / oneIsFlorida);
        System.out.printf(">1 Florida(U)  %7d%n", oneIsFloridaUnique);
        System.out.printf("both girls(FU) %7d%n", oneFloridaBothGirlsUnique);
        System.out.printf("chance         %9.2f%%%n",(100f * oneFloridaBothGirlsUnique) / oneIsFloridaUnique);
        System.out.println("Captain Hindsight to the rescue??");
        int randomIsGirl = 0;
        bothGirls = 0;
        for (int i = 0; i < children.length; i++) {
            Child[] pair = children[i];
            int c = rnd.nextInt(2);
            if (pair[c].female) {
                randomIsGirl++;
                if (pair[1-c].female) {
                    bothGirls++;
                }
            }
        }
        System.out.printf("random is girl %7d%n", randomIsGirl);
        System.out.printf("both girls     %7d%n", bothGirls);
        System.out.printf("chance         %9.2f%%%n",(100f * bothGirls) / randomIsGirl);
    }
    
}