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 special = int.Parse(Console.ReadLine());
- int control = int.Parse(Console.ReadLine());
- int numToCheck = 0;
- for (int i = m; i >= 1; i--)
- {
- for (int j = n; j >= 1; j--)
- {
- for (int k = l; k >= 1; k--)
- {
- numToCheck = i * 100 + j * 10 + k;
- if (numToCheck % 3 ==0)
- {
- special += 5;
- }
- else if (numToCheck % 10 == 5)
- {
- special -= 2;
- }
- else if (numToCheck % 2 == 0)
- {
- special *= 2;
- }
- if (special >=control)
- {
- Console.WriteLine("Yes! Control number was reached! Current special number is {0}.", special);
- return;
- }
- }
- }
- }
- Console.WriteLine("No! {0} is the last reached special number.", special);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement