Click Here to go back to the homepage.

Mosquito Multiplication Solution:


#include <bits/stdc++.h>
using namespace std;

int main(){
    // #ifndef TESTING
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif
    // M -> E -> L -> P
    int M, P, L, E, R, S, N;
    while(cin >> M >> P >> L >> E >> R >> S >> N){
        for(int i = 0; i < N; i++){
            int newM, newP, newL;
            newP = L / R;
            newM = P / S;
            newL = M * E;
            L = newL;
            P = newP;
            M = newM;
        }
        cout << M << endl;
    }

    return 0;
}