Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace NumberGenerator
- {
- class Program
- {
- static void Main(string[] args)
- {
- int m = int.Parse(Console.ReadLine());
- int n = int.Parse(Console.ReadLine());
- int l = int.Parse(Console.ReadLine());
- int spec = int.Parse(Console.ReadLine());
- int control = int.Parse(Console.ReadLine());
- bool isFound = false;
- for (int a1 = m; a1 >= 1; a1--)
- {
- if (isFound)
- {
- break;
- }
- for (int a2 = n; a2 >= 1; a2--)
- {
- if (isFound)
- {
- break;
- }
- for (int a3 = l; a3 >= 1; a3--)
- {
- int currentNumber = a1 * 100 + a2 * 10 + a3;
- if (currentNumber % 3 == 0)
- {
- spec += 5;
- }
- else if (currentNumber % 10 == 5)
- {
- spec -= 2;
- }
- else if (currentNumber % 2 == 0)
- {
- spec = spec * 2;
- }
- if (spec >= control)
- {
- Console.WriteLine("Yes! Control number was reached! Current special number is {0}.", spec);
- isFound = true;
- break;
- //return;
- }
- }
- }
- }
- if (!isFound)
- {
- Console.WriteLine("No! {0} is the last reached special number.", spec);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement