Cod sursa(job #1841191)
| Utilizator | Data | 5 ianuarie 2017 13:43:52 | |
|---|---|---|---|
| Problema | Secventa 3 | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.69 kb |
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream fin("secv3.in");
ofstream fout("secv3.out");
int main()
{
long n,l,u,c,t,i,j,k;
float x,max=0,s1=0,s2=0;
fin>>n>>l>>u;
long m[2][n];
for (i=1;i<=n;i++)
fin>>m[1][i];
for (i=1;i<=n;i++)
fin>>m[2][i];
for (i=l;i<=u;i++)
for (j=1;j<=n-i+1;j++)
{
for (k=j;k<=j+i-1;k++)
{
s1+=m[1][k];
s2+=m[2][k];
}
x=s1/s2;
if (x>max) max=x;
s1=0;
s2=0;
}
fout<<fixed<<setprecision(2)<<max;
return 0;
}
