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 Program
- {
- static void Main(string[] args)
- {
- char[] letter = { 'A', 'B', 'C', 'E', 'H', 'K', 'M', 'P', 'T', 'X' };
- int[] weights = { 10, 20, 30, 50, 80, 110, 130, 160, 200, 240 };
- int inputSum = Int32.Parse(Console.ReadLine());
- int weightOfCA = weights[Array.IndexOf(letter, 'C')] + weights[Array.IndexOf(letter, 'A')];
- int counter = 0;
- for (int firstDigit = 0; firstDigit < 10; firstDigit++)
- {
- for (int secondDigit = 0; secondDigit < 10; secondDigit++)
- {
- for (int thirdDigit = 0; thirdDigit < 10; thirdDigit++)
- {
- for (int forthDigit = 0; forthDigit < 10; forthDigit++)
- {
- for (int firstLetter = 0; firstLetter < 10; firstLetter++)
- {
- char currLetter = letter[firstLetter];
- int currWeight = weights[firstLetter];
- for (int secondLetter = 0; secondLetter < 10; secondLetter++)
- {
- char secondCurrLetter = letter[secondLetter];
- int secondCurrWeight = weights[secondLetter];
- // tuka lainata po4vat da se slu4vat , mamaudaiba
- if (firstDigit == secondDigit && secondDigit == thirdDigit && thirdDigit == forthDigit ||
- secondDigit == thirdDigit && thirdDigit == forthDigit && firstDigit != forthDigit ||
- firstDigit == secondDigit && secondDigit == thirdDigit && forthDigit != thirdDigit ||
- firstDigit == secondDigit && thirdDigit == forthDigit && forthDigit != firstDigit ||
- firstDigit == thirdDigit && secondDigit == forthDigit && firstDigit != secondDigit ||
- firstDigit == forthDigit && secondDigit == thirdDigit && firstDigit != secondDigit)
- {
- int sumOfCurrentSetOfCHars = weightOfCA + firstDigit + secondDigit + thirdDigit + forthDigit +
- currWeight + secondCurrWeight;
- if (sumOfCurrentSetOfCHars == inputSum)
- {
- counter++;
- }
- }
- }
- }
- }
- }
- }
- }
- Console.WriteLine(counter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement