You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
483 B
C++

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m, r;
scanf("%d%d%d", &n, &m, &r);
int m1 = numeric_limits<int>::max(), m2 = numeric_limits<int>::min();
for (int i = 0, x; i < n; i++) scanf("%d", &x), m1 = min(m1, x);
for (int i = 0, x; i < m; i++) scanf("%d", &x), m2 = max(m2, x);
printf("%d", max(r, r / m1 * m2 + r % m1));
return 0;
}