Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int m, n, l, special, control;
- cin >> m >> n >> l >> special >> control;
- for (int i = m; i > 0; i--) {
- for (int j = n; j > 0; j--) {
- for (int k = l; k > 0; k--) {
- int num = i * 100 + j * 10 + k;
- if (num % 3 == 0) {
- special += 5;
- }
- else if (num % 5 == 0) {
- special -= 2;
- }
- else if (num % 2 == 0) {
- special *= 2;
- }
- if (special >= control) {
- cout << "Yes! Control number was reached! Current special number is " << special << ".\n";
- return 0;
- }
- }
- }
- }
- cout << "No! " << special << " is the last reached special number.\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement