Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace PokerStraight
- {
- class PokerStraight
- {
- static void Main()
- {
- int targetWeight = int.Parse(Console.ReadLine());
- string[] cardRanks = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
- int[] cardFacesWeights = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
- int[] cardSuitsWeights = {1, 2, 3, 4};
- int count = 0;
- for (int i = 0; i < cardRanks.Length-4; i++)
- {
- for (int j = 0; j < 4; j++)
- {
- for (int k = 0; k < 4; k++)
- {
- for (int l = 0; l < 4; l++)
- {
- for (int m = 0; m < 4; m++)
- {
- for (int n = 0; n < 4; n++)
- {
- int tempWeight = 10*cardFacesWeights[i] + cardSuitsWeights[j] +
- 20*cardFacesWeights[i + 1] + cardSuitsWeights[k] +
- 30*cardFacesWeights[i + 2] + cardSuitsWeights[l] +
- 40*cardFacesWeights[i + 3] + cardSuitsWeights[m] +
- 50*cardFacesWeights[i + 4] + cardSuitsWeights[n];
- if (tempWeight==targetWeight)
- {
- count++;
- }
- }
- }
- }
- }
- }
- }
- Console.WriteLine(count);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment