Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int M = int.Parse(Console.ReadLine());
- int N = int.Parse(Console.ReadLine());
- int L = int.Parse(Console.ReadLine());
- int special = int.Parse(Console.ReadLine());
- int control = int.Parse(Console.ReadLine());
- for (int i = M; i >= 1; i--)
- {
- for (int j = N; j >= 1; j--)
- {
- for (int k = L; k >= 1; k--)
- {
- int num = int.Parse($"{i}{j}{k}");
- if (num % 3 == 0) special += 5;
- else if (num % 10 == 5) special -= 2;
- else if (num % 2 == 0) special *= 2;
- if (special >= control)
- {
- Console.WriteLine($"Yes! Control number was reached! Current special number is {special}.");
- return;
- }
- }
- }
- }
- Console.WriteLine($"No! {special} is the last reached special number.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement