Cod sursa(job #2126420)
| Utilizator | Data | 9 februarie 2018 16:54:17 | |
|---|---|---|---|
| Problema | Secventa 3 | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.67 kb |
#include <iostream>
#include <cstring>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
ifstream fin("secv3.in");
//ofstream fout("secv3.out");
int n,l,u,i,a[11],j,k,scv,sct;
float maxi;
fin>>n>>l>>u;
scv=0;
sct=0;
maxi=0;
i=1;
while(!fin.eof())
{
fin>>a[i];
i++;
}
k=l;
while(k<=u)
{for(i=1;i<=5-k;i++)
scv=0;
sct=0;
for(j=i;j<i+k;j++)
{
scv=scv+a[j];
sct=sct+a[j+5];
}
if((float)scv/sct>maxi)
maxi=(float)scv/sct;
k++;
}
cout<<maxi;
return 0;
}
