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;
- class Gambling
- {
- static void Main(string[] args)
- {
- int cash = int.Parse(Console.ReadLine());
- int potAmount = cash * 2;
- string[] housesHand = Console.ReadLine().Split(' ');
- //int card1 = int.Parse(housesHand[0]);
- //int card2 = int.Parse(housesHand[1]);
- //int card3 = int.Parse(housesHand[2]);
- //int card4 = int.Parse(housesHand[3]);
- int allCards = 0;
- for (int i = 0; i < housesHand.Length; i++)
- {
- switch (housesHand[i])
- {
- case "J":
- allCards += 11;
- break;
- case "Q":
- allCards += 12;
- break;
- case "K":
- allCards += 13;
- break;
- case "A":
- allCards += 14;
- break;
- default:
- allCards += int.Parse(housesHand[i]);
- break;
- }
- }
- int allPossibleCombinations = 0;
- int myWinningCombinations = 0;
- for (int card1 = 2; card1 <= 14; card1++)
- {
- for (int card2 = 2; card2 <= 14; card2++)
- {
- for (int card3 = 2; card3 <= 14; card3++)
- {
- for (int card4 = 2; card4 <= 14; card4++)
- {
- allPossibleCombinations++;
- int currecntPoints = card1 + card2 + card3 + card4;
- if (currecntPoints > allCards)
- {
- myWinningCombinations++;
- }
- }
- }
- }
- }
- Console.WriteLine(myWinningCombinations);
- Console.WriteLine(allPossibleCombinations);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement