WORK #3

mail@pastecode.io avatar
unknown
c_cpp
a year ago
501 B
1
Indexable
Never
#include <iostream>
#include <vector>

using namespace std;

long long n, m, s;

long long get_ans(long long a, long long b) {
    return max((n / a) * (m / b), (n / b) * (m / a));
}

int main() {
    cin >> n;
    cin >> m;
    cin >> s;
    vector<long long> divs;
    long long ans = 0;
    for (long long i = 2; i * i <= s; i++) {
        if (s % i == 0) {
            ans = max(ans, get_ans(i, s / i));
        }
    }
    ans = max(ans, get_ans(1, s));
    cout << ans;
}