Advertisement
Guest User

MagicCarNumbers

a guest
May 24th, 2014
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. int CA = 40;
  2. int input = int.Parse(Console.ReadLine());
  3. int[] letters = { 10, 20, 30, 50, 80, 110, 130, 160, 200, 240 };
  4. int count = 0;
  5. for(int a = 0;a<10;a++)
  6. {
  7. for (int b = 0; b < 10; b++)
  8. {
  9. for (int c = 0; c < 10; c++)
  10. {
  11. for (int d = 0; d < 10; d++)
  12. {
  13. for (int e = 0; e < 10; e++)
  14. {
  15. for (int f = 0; f < 10; f++)
  16. {
  17. int tempresult = CA + a + b + c + d + letters[e] + letters[f];
  18. if(tempresult==input)
  19. {
  20. if(a==b)
  21. {
  22. if(b==c && c==d)
  23. {
  24. count++;
  25. }
  26. else if(b==c && c!=d)
  27. {
  28. count++;
  29. }
  30. else if(c!=a && c==d)
  31. {
  32. count++;
  33. }
  34. }
  35. else if(a!=b && b==c && c==d)
  36. {
  37. count++;
  38. }
  39. else if(a==c && b==d && b!=a)
  40. {
  41. count++;
  42. }
  43. else if(a==d && b==c && a!=c)
  44. {
  45. count++;
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52. }
  53. }
  54. Console.WriteLine(count);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement