Advertisement
bullit3189

5 Special letters

Nov 8th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. int start = int.Parse(Console.ReadLine());
  8. int end = int.Parse(Console.ReadLine());
  9. string pattern = "abcde";
  10. int counter =0;
  11. for (int i = 0; i < 5; i++)
  12. {
  13. for (int j = 0; j < 5; j++)
  14. {
  15. for (int k = 0; k < 5; k++)
  16. {
  17. for (int l = 0; l < 5; l++)
  18. {
  19. for (int m = 0; m < 5; m++)
  20. {
  21. string current = "" + pattern[i] + pattern[j] + pattern[k] + pattern[l] + pattern[m];
  22.  
  23. string unique = "" + current[0];
  24.  
  25. for (int f = 1; f < 5; f++)
  26. {
  27. if (unique.IndexOf(current[f]) == -1)
  28. {
  29. unique += current[f];
  30. }
  31. }
  32. int add = 0;
  33. int sum = 0;
  34. for (int f = 0; f < unique.Length; f++)
  35. {
  36. switch (unique[f])
  37. {
  38. case 'a':
  39. add = 5;
  40. break;
  41. case 'b':
  42. add = -12;
  43. break;
  44. case 'c':
  45. add = 47;
  46. break;
  47. case 'd':
  48. add = 7;
  49. break;
  50. case 'e':
  51. add = -32;
  52. break;
  53. }
  54. sum += (f + 1) * add;
  55. }
  56. if (sum >= start && sum <= end)
  57. {
  58. Console.Write(current + " ");
  59. counter++;
  60. }
  61. }
  62. }
  63. }
  64. }
  65. }
  66. if (counter<1)
  67. {
  68. Console.WriteLine("No");
  69. }
  70.  
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement