http://codeforces.com/contest/449/problem/A
form WJMZBMR
1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <cstring> 5 #include <string> 6 using namespace std; 7 8 typedef long long int64; 9 10 #define checkMax(a,b) a=max(a,b) 11 12 13 14 int main() { 15 int n, m, k; 16 cin >> n >> m >> k; 17 if (n - 1 + m - 1 < k) { 18 puts("-1"); 19 return 0; 20 } 21 int64 ans = 0; 22 // int cnt = 0; 23 for (int64 i = 1; i <= n; i++) { 24 // ++cnt; 25 int64 r = n / (n / i); 26 i = r; 27 if (k - (r - 1) > m - 1) 28 continue; 29 int64 o = max(k - (r - 1) + 1, 1LL); 30 checkMax(ans, 1LL * (n / r) * (m / o)); 31 //cout << " " << z << " " << t << " " << tt << endl; 32 } 33 // cout << cnt << endl; 34 cout << ans << endl; 35 return 0; 36 }