Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int m = int.Parse(Console.ReadLine());
- int l = int.Parse(Console.ReadLine());
- int special = int.Parse(Console.ReadLine());
- int control = int.Parse(Console.ReadLine());
- int sumator = 0;
- for(int i = n; i >= 1; i --)
- {
- for(int j = m; j >= 1; j --)
- {
- for(int k = l; k >= 1; k --)
- {
- sumator = 100 * i + 10 * j + k;
- if(sumator % 3 == 0)
- {
- special += 5;
- }
- else if(sumator % 10 == 5)
- {
- special -= 2;
- }
- else if(sumator % 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