Pagini recente » Profil Arunn_Azyz | Cod sursa (job #3212881) | Cod sursa (job #3242274) | Cod sursa (job #3295) | Cod sursa (job #3282018)
#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);
fout << setprecision(4) << ans << '\n';
return 0;
}