Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- int start = int.Parse(Console.ReadLine());
- int end = int.Parse(Console.ReadLine());
- string pattern = "abcde";
- int counter =0;
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- for (int k = 0; k < 5; k++)
- {
- for (int l = 0; l < 5; l++)
- {
- for (int m = 0; m < 5; m++)
- {
- string current = "" + pattern[i] + pattern[j] + pattern[k] + pattern[l] + pattern[m];
- string unique = "" + current[0];
- for (int f = 1; f < 5; f++)
- {
- if (unique.IndexOf(current[f]) == -1)
- {
- unique += current[f];
- }
- }
- int add = 0;
- int sum = 0;
- for (int f = 0; f < unique.Length; f++)
- {
- switch (unique[f])
- {
- case 'a':
- add = 5;
- break;
- case 'b':
- add = -12;
- break;
- case 'c':
- add = 47;
- break;
- case 'd':
- add = 7;
- break;
- case 'e':
- add = -32;
- break;
- }
- sum += (f + 1) * add;
- }
- if (sum >= start && sum <= end)
- {
- Console.Write(current + " ");
- counter++;
- }
- }
- }
- }
- }
- }
- if (counter<1)
- {
- Console.WriteLine("No");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement