isefire icon

Hairdo

isefire | PRO | 07/28/14 03:02:44 AM UTC | 0 ⭐ | 395 👁️ | Never ⏰ | []
Java |

690 B

|

None

|

0 👍

/

0 👎

public class Hairdo
{
    public static boolean should(boolean[] j)
    {
        int k = 0; //false
        int z = 0; //true
        for (int i = 0; i < j.length; i++)
        {
            if (j[i] == false) k+=1;
            else z+=1;
        }
        if (k >= z) return false;
        return true;
    }
    public static boolean[] hairdo(boolean[] j)
    {
        for (int i = 0; i < j.length; i++)
        {
            double c = Math.random();
            if (c >= .5) j[i] = true;
        }
        return j;
    }
    public static void main(String[] args)
    {
        // length of array
        int num = Integer.parseInt(args[0]);
        boolean[] j = new boolean[num];
        j = hairdo(j);
        boolean a = should(j);
        if (a==true) System.out.println("Pixie");
        else System.out.println("Long");
    }
}

Comments