Pagini recente » Cod sursa (job #3217094) | Cod sursa (job #10272) | Cod sursa (job #3278656) | Cod sursa (job #40354) | Cod sursa (job #3282019)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("secv3.in");
ofstream fout("secv3.out");
const int NMax = 30005;
long long t[NMax], s[NMax], sp[NMax];
long long cmmdc(long long x, long long y){
long long m;
while(y > 0){
m = x % y;
x = y;
y = m;
}
return x;
}
long long cmmmc(long long x, long long y){
return (x * y) / cmmdc(x, y);
}
long long amplificare(int N){
long long ans = t[1];
for(int i = 2; i <= N; ++ i){
ans = cmmmc(ans, t[i]);
}
for(int i = 1; i <= N; ++ i){
s[i] *= (ans / t[i]);
}
return ans;
}
double query(int N, long long amplif, int lng){
double ans = -1;
for(int i = lng; i <= N; ++ i){
ans = max(ans, (sp[i] - sp[i - lng]) * 1.0 / lng);
}
return ans * 1.0 / amplif;
}
int main()
{
int N, L, U;
fin >> N >> L >> U;
for(int i = 1; i <= N; ++ i){
fin >> s[i];
}
for(int i = 1; i <= N; ++ i){
fin >> t[i];
}
long long amplif = amplificare(N);
sp[1] = s[1];
for(int i = 2; i <= N; ++ i){
sp[i] = sp[i - 1] + s[i];
}
double ans = query(N, amplif, L);
for(int i = L; i <= U; ++ i){
double ans1 = query(N, amplif, i);
ans = max(ans, ans1);
}
fout << setprecision(18) << ans << '\n';
return 0;
}