Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Problem03_FullHouse {
- public static void main(String[] args) {
- String[] faces = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "D", "K", "A"};
- char[] suits = {'♣', '♦', '♥', '♠'};
- int count = 0;
- for (int i1 = 0; i1 < faces.length; i1++) { //first three faces
- for (int j1 = 0; j1 < suits.length; j1++) { //suits of the first three faces
- for (int j2 = 0; j2 < suits.length; j2++){
- if (j1 == j2) {
- continue;
- }
- for (int j3 = 0; j3 < suits.length; j3++) {
- if (j1 == j3 || j2 == j3) {
- continue;
- }
- for (int i2 = 0; i2 < faces.length; i2++) { //second two faces
- //===========================
- for (int j4 = 0; j4 < suits.length; j4++) { //suits of second two faces
- for (int j5 = 0; j5 < suits.length; j5++) {
- if (j4 == j5) {
- continue;
- }
- if (i1 != i2) {
- System.out.printf(faces[i1] + suits[j1]+
- faces[i1] + suits[j2] +
- faces[i1] + suits[j3] +
- faces[i2] + suits[j4] +
- faces[i2] + suits[j5] + " ");
- count++;
- }
- }
- }
- }
- }
- }
- }
- }
- System.out.println();
- System.out.println("Full houses: " + count);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement