a1 = int(input())
a2 = int(input())
k1 = int(input())
k2 = int(input())
n = int(input())
mn = n - ((k1 - 1) * a1 + (k2 - 1) * a2)
if mn < 0:
mn = 0
if k1 < k2:
mx = min(n // k1, a1)
n -= mx * k1
mx += min(n // k2, a2)
else:
mx = min(n // k2, a2)
n -= mx * k2
mx += min(n // k1, a1)
print(mn, mx)
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
const int N = 1e5 + 9, MOD = 1000000007;
typedef long long ll;
using namespace std;
void solve()
{
ll a1, a2, k1, k2, n, n2, mx = 0;
cin >> a1 >> a2 >> k1 >> k2 >> n;
n2 = n;
n -= ((a1 * (k1 - 1)) + (a2 * (k2 - 1)));
cout << max(n, 0LL) << " ";
if (k1 > k2)
{
swap(a1, a2);
swap(k1, k2);
}
mx = min(a1, n2 / k1);
n2 -= mx * k1;
if (n2 >= 0)
mx += min(a2, n2 / k2);
cout << mx;
}
int main(void)
{
IO;
int t = 1;
// cin >> t;
while (t--)
solve();
return 0;
}
1191A - Tokitsukaze and Enhancement | 903A - Hungry Student Problem |
52B - Right Triangles | 1712A - Wonderful Permutation |
1712D - Empty Graph | 1712B - Woeful Permutation |
1712C - Sort Zero | 1028B - Unnatural Conditions |
735B - Urbanization | 746C - Tram |
1278B - A and B | 1353D - Constructing the Array |
1269C - Long Beautiful Integer | 1076A - Minimizing the String |
913C - Party Lemonade | 1313A - Fast Food Restaurant |
681A - A Good Contest | 1585F - Non-equal Neighbours |
747A - Display Size | 285A - Slightly Decreasing Permutations |
515C - Drazil and Factorial | 1151E - Number of Components |
1151F - Sonya and Informatics | 556A - Case of the Zeros and Ones |
867A - Between the Offices | 1569A - Balanced Substring |
260A - Adding Digits | 1698C - 3SUM Closure |
1029B - Creating the Contest | 1421A - XORwice |