Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class MagicCarNumbers
- {
- static void Main()
- {
- int magNum = int.Parse(Console.ReadLine());
- int startValue = 40;
- int[] charValues = {10,20,30,50,80,110, 130,160, 200, 240 };
- int counter = 0;
- //char first;
- //char second;
- //++++++++++++++++++++++++++++
- for (int fst = 0; fst <= 9; fst++ )
- {
- for (int snd = 0; snd <= 9; snd++)
- {
- for (int trd = 0; trd <= 9; trd++)
- {
- for (int fth = 0; fth <= 9; fth++)
- {
- //Chars
- for (int fstLett = 0; fstLett < 10; fstLett++ )
- {
- for (int sndLett = 0; sndLett < 10; sndLett++ )
- {
- if (startValue + fst + snd + trd + fth +
- charValues[fstLett] + charValues[sndLett] == magNum)
- {
- if((fst == snd && snd == trd) || (snd == trd && trd == fth) ||
- (fst == trd && snd == fth) || (fst == snd && snd == trd && trd == fth) ||
- (fst == snd && trd == fth) || (fst == fth && snd == trd))
- {
- /*first = checkChar(charValues[fstLett]);
- second = checkChar(charValues[sndLett]);
- Console.WriteLine("CA{0}{1}{2}{3}{4}{5}", fst, snd, trd, fth, first, second);*/
- counter++;
- }
- }
- }
- }
- }
- }
- }
- }
- Console.WriteLine(counter);
- }
- /*private static char checkChar(int p)
- {
- char x = new char();
- switch (p)
- {
- case 10: x = 'A';
- break;
- case 20: x = 'B';
- break;
- case 30: x = 'C';
- break;
- case 50: x = 'E';
- break;
- case 80: x = 'H';
- break;
- case 110: x = 'K';
- break;
- case 130: x = 'M';
- break;
- case 160: x = 'P';
- break;
- case 200: x = 'T';
- break;
- case 240: x = 'X';
- break;
- }
- return x;
- }*/
- }
Advertisement
Add Comment
Please, Sign In to add comment