Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- int M = int.Parse(Console.ReadLine());
- int N = int.Parse(Console.ReadLine());
- int L = int.Parse(Console.ReadLine());
- int specialNumber = int.Parse(Console.ReadLine());
- int controlNumber = int.Parse(Console.ReadLine());
- int MNL = (100 * M + 10 * N + L);
- int diapazon = 111;
- for (int i = MNL; i >= diapazon; i--)
- {
- if (i % 3 == 0)
- {
- specialNumber += 5;
- }
- else if (i % 10 == 5)
- {
- specialNumber -= 2;
- }
- else if (i % 2 == 0)
- {
- specialNumber *= 2;
- }
- if (specialNumber < controlNumber)
- {
- // do nothing
- }
- else if (specialNumber >= controlNumber)
- {
- break;
- }
- }
- if (specialNumber >= controlNumber)
- {
- Console.WriteLine("Yes! Control number was reached! Current special number is {0}.", specialNumber);
- }
- else
- {
- Console.WriteLine("No! {0} is the last reached special number.", specialNumber);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement