Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PokerStraight
- {
- class PokerStraight
- {
- public static int result = 0;
- static void Main()
- {
- int weight = int.Parse(Console.ReadLine());
- int[] face = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
- int[] suit = new int[] {1, 2, 3, 4};
- for (int clubs = 0; clubs < 4; clubs++)
- {
- for (int diamonds = 0; diamonds < 4; diamonds++)
- {
- for (int hearts = 0; hearts < 4; hearts++)
- {
- for (int spades = 0; spades < 4; spades++)
- {
- for (int lastCardSuit = 0; lastCardSuit < 4; lastCardSuit++)
- {
- CalculateWeight(face, weight, suit[clubs], suit[diamonds],
- suit[hearts], suit[spades],suit[lastCardSuit]);
- }
- }
- }
- }
- }
- Console.WriteLine(result);
- }
- private static void CalculateWeight(int[] face, int weight,int clubs, int diamond, int hearts, int spades, int lastCardSuit)
- {
- for (int cardIndex = 0; cardIndex < face.Length - 4; cardIndex++)
- {
- int getWeight = (10 * face[cardIndex] + clubs) + (20 * face[cardIndex+1] + diamond) + (30 * face[cardIndex+2] + hearts)
- + (40 * face[cardIndex+3] + spades) + (50 * face[cardIndex+4] + lastCardSuit);
- result = getWeight == weight ? result += 1 : result;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement