Advertisement
Guest User

FullHouse

a guest
Sep 14th, 2014
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1.  
  2. public class Problem03_FullHouse {
  3.  
  4. public static void main(String[] args) {
  5.  
  6. String[] faces = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "D", "K", "A"};
  7. char[] suits = {'♣', '♦', '♥', '♠'};
  8. int count = 0;
  9.  
  10. for (int i1 = 0; i1 < faces.length; i1++) { //first three faces
  11.  
  12.  
  13. for (int j1 = 0; j1 < suits.length; j1++) { //suits of the first three faces
  14.  
  15. for (int j2 = 0; j2 < suits.length; j2++){
  16.  
  17. if (j1 == j2) {
  18. continue;
  19. }
  20. for (int j3 = 0; j3 < suits.length; j3++) {
  21.  
  22. if (j1 == j3 || j2 == j3) {
  23. continue;
  24. }
  25. for (int i2 = 0; i2 < faces.length; i2++) { //second two faces
  26. //===========================
  27.  
  28. for (int j4 = 0; j4 < suits.length; j4++) { //suits of second two faces
  29.  
  30. for (int j5 = 0; j5 < suits.length; j5++) {
  31.  
  32. if (j4 == j5) {
  33. continue;
  34. }
  35. if (i1 != i2) {
  36. System.out.printf(faces[i1] + suits[j1]+
  37. faces[i1] + suits[j2] +
  38. faces[i1] + suits[j3] +
  39. faces[i2] + suits[j4] +
  40. faces[i2] + suits[j5] + " ");
  41. count++;
  42. }
  43.  
  44.  
  45. }
  46. }
  47.  
  48. }
  49. }
  50. }
  51. }
  52.  
  53. }
  54. System.out.println();
  55.  
  56. System.out.println("Full houses: " + count);
  57.  
  58. }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement