Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment