Advertisement
Spocoman

Number Generator

Sep 25th, 2023
481
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 1 0
  1. m = int(input())
  2. n = int(input())
  3. l = int(input())
  4. special = int(input())
  5. control = int(input())
  6.  
  7. for i in range(m, 0, -1):
  8.     for j in range(n, 0, -1):
  9.         for k in range(l, 0, -1):
  10.             num = i * 100 + j * 10 + k
  11.  
  12.             if num % 3 == 0:
  13.                 special += 5
  14.             elif num % 5 == 0:
  15.                 special -= 2
  16.             elif num % 2 == 0:
  17.                 special *= 2
  18.  
  19.             if special >= control:
  20.                 print(f"Yes! Control number was reached! Current special number is {special}.")
  21.                 exit(0)
  22.  
  23. print(f"No! {special} is the last reached special number.")
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement