Advertisement
Guest User

3. Full House

a guest
May 21st, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1.  
  2. public class _03_FullHouse {
  3.     public static void main (String[] args) {
  4.         String[]  cards = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
  5.         char[] patterns = {'♣', '♦', '♥', '♠'};
  6.         int counter = 0;
  7.         for (int i = 0; i < 13; i++) {
  8.             for (int j = 0; j < 13; j++) {
  9.                 if (i != j) {
  10.                
  11.                     for (int first = 0; first < 4; first++) {
  12.                         for (int second = first + 1; second < 4; second++) {
  13.                             for (int third = second + 1; third < 4; third++) {
  14.                                 for (int fourth = 0; fourth < 4; fourth++) {
  15.                                     for (int fifth = fourth + 1; fifth < 4; fifth++) {
  16.                                         counter++;
  17.         System.out.println(cards[i] + "" + patterns[first] + "" +cards[i] + "" + patterns[second]
  18.                 + "" + cards[i] + "" + patterns[third] + "" + cards[j] + "" + patterns[fourth] + "" +
  19.                 cards[j] + "" + patterns[fifth] + " ");
  20.                                     }
  21.                                 }
  22.                             }
  23.                         }
  24.                     }
  25.                
  26.                 }
  27.                
  28.             }
  29.         }
  30.         System.out.println(counter);
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement