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.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading.Tasks;
- namespace BasicsStuff1
- {
- 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 specialNum = int.Parse(Console.ReadLine());
- int contol = int.Parse(Console.ReadLine());
- bool isReached = false;
- for (int i = m; i >= 1; i--)
- {
- for (int j = n; j >= 1; j--)
- {
- for (int k = l; k >= 1; k--)
- {
- string a = i.ToString() + j.ToString() + k.ToString();
- if (int.Parse(a)% 3 == 0)
- {
- specialNum = specialNum + 5;
- }
- else if ( k== 5)
- {
- specialNum = specialNum - 2;
- }
- else if (k %2 == 0)
- {
- specialNum = specialNum * 2;
- }
- if (specialNum >= contol)
- {
- isReached = true;
- break;
- }
- }
- if (isReached)
- {
- break;
- }
- }
- if (isReached)
- {
- break;
- }
- }
- if (isReached)
- {
- Console.WriteLine($"Yes! Control number was reached! Current special number is {specialNum}.");
- }
- else
- {
- Console.WriteLine($"No! {specialNum} is the last reached special number.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement