Pagini recente » Cod sursa (job #3186427) | Cod sursa (job #2455093) | Cod sursa (job #1278521) | Cod sursa (job #761619) | Cod sursa (job #2330293)
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 30005;
int c[MAXN], t[MAXN];
int main()
{
ifstream fin("secv3.in");
ofstream fout("secv3.out");
int n, l, u;
fin >> n >> l >> u;
for(int i = 1; i <= n; ++i){
fin >> c[i];
c[i] += c[i - 1];
}
for(int i = 1; i <= n; ++i){
fin >> t[i];
t[i] += t[i - 1];
}
int st = 0;
double ans = 0.00;
for(int i = 1; i <= n; ++i){
if(st < i - u)
st++;
if(i >= l){
if((c[i] - c[i - l]) * (t[i] - t[st]) > (c[i] - c[st]) * (t[i] - t[i - l]))
st = i - l;
ans = max(ans, 1.000 * (c[i] - c[st]) / (t[i] - t[st]));
}
}
fout << fixed << setprecision(2) << ans;
return 0;
}