Cod sursa(job #1068390)
| Utilizator | Data | 28 decembrie 2013 12:19:35 | |
|---|---|---|---|
| Problema | Secventa 3 | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.58 kb |
#include<fstream>
#include<iomanip>
using namespace std;
ifstream f("secv3.in");
ofstream g("secv3.out");
struct lin{
double c,t,s1,s2;
}a[30006];
long long n,m,i,j,l,u,k;
double max1,x,y;
int main()
{
f>>n>>l>>u;
for(i=1;i<=n;i++) f>>a[i].c;
for(i=1;i<=n;i++) f>>a[i].t;
max1=0;
for(i=1;i<=n-l+1;i++)
{
x=0; y=0;
for(j=i;j<=i+u&&j<=n;j++)
{
x+=a[j].c;
y+=a[j].t;
if(j-i+1>=l) max1=max(max1,x/y);
}
}
g<<fixed<<setprecision(2)<<max1;
return 0;
}
