Advertisement
Guest User

Untitled

a guest
May 19th, 2014
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. public class _03_FullHouse {
  2.  
  3.     public static void main(String[] args) {
  4.        
  5.         String[] cards = new String[52];
  6.         String[] cardType = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
  7.         char[] cardSymbol = {'♠', '♥', '♣', '♦'};
  8.         int countFH = 0;
  9.        
  10.         for (int i = 0, indx = 0; i < 13; i++) {
  11.             for (int j = 0; j < 4; j++, indx++) {
  12.                    
  13.                 cards[indx] = cardType[i] + cardSymbol[j];
  14.             }
  15.         }
  16.  
  17.         for (int n = 0; n < 13; n++) {
  18.             for (int a = n * 4; a < (n * 4 + 4); a++) {
  19.                 for (int b = a + 1; b < (n * 4 + 4); b++) {
  20.                     for (int c = b + 1; c < (n * 4 + 4); c++) {
  21.  
  22.                         for (int m = 0; m < 13; m++) {
  23.                             if(n != m){
  24.                                 for (int d = m * 4; d < (m * 4 + 4); d++) {
  25.                                     for (int e = d + 1; e < (m * 4 + 4); e++) {
  26.                                         System.out.printf("%s %s %s %s %s \n",
  27.                                                         cards[a], cards[b], cards[c], cards[d], cards[e]);
  28.                                         countFH++;
  29.                                     }
  30.                                 }
  31.                             }
  32.                         }
  33.                        
  34.                     }              
  35.                 }
  36.             }
  37.         }
  38.         System.out.println(countFH);
  39.     }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement