#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
using namespace std;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k, m;
cin >> n >> k >> m;
vector<int> v(k+5);
for (int i = 1; i <= k; i++) cin >> v[i];
int ans = 0;
sort(v.begin() + 1, v.begin() + k + 1);
for (int i = 0; i <= n; i++) {
int res = 0;
for (int j = 1; j <= k; j++) res += i*v[j];
if (res > m) break;
int cur = i*(k + 1);
int sisa = m - res;
for (int j = 1; j <= k; j++) {
if (v[j]*(n - i) <= sisa) {
sisa -= v[j]*(n - i);
cur += n - i;
} else {
cur += sisa/v[j];
break;
}
}
ans = max(ans, cur);
}
cout << ans << '\n';
return 0;
}
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |
Duration | Birthday Party |
e-maze-in | Bricks Game |
Char Sum | Two Strings |
Anagrams | Prime Number |
Lexical Sorting Reloaded | 1514A - Perfectly Imperfect Array |
580A- Kefa and First Steps | 1472B- Fair Division |
996A - Hit the Lottery | MSNSADM1 Football |
MATCHES Playing with Matches | HRDSEQ Hard Sequence |
DRCHEF Doctor Chef | 559. Maximum Depth of N-ary Tree |
821. Shortest Distance to a Character | 1441. Build an Array With Stack Operations |