Pagini recente » Istoria paginii utilizator/igroita | Cod sursa (job #1983847) | Cod sursa (job #1473564) | Cod sursa (job #596946) | Cod sursa (job #2222591)
#include <fstream>
using namespace std;
ifstream fin("secv3.in");
ofstream fout("secv3.out");
int nrnr, nr1, nr2;
int vecv[30000][2];
int vect[30000][2];
double sav, maxi = 0.0;
int main()
{
fin >> nrnr >> nr1 >> nr2;
for(int index = 0; index < nrnr; index++){
fin >> vecv[index][0];
}
for(int index = 0; index < nrnr; index++){
fin >> vect[index][0];
sav = (double)vecv[index][0] / (double)vect[index][0];
if(sav > maxi){
maxi = sav;
}
}
for(int index = 1; index < nrnr; index++){
for(int index2 = 0; index2 < nrnr - index; index2++){
vecv[index2][index % 2] = vecv[index2][(index + 1) % 2] + vecv[index2 + 1][(index + 1) % 2];
vect[index2][index % 2] = vect[index2][(index + 1) % 2] + vect[index2 + 1][(index + 1) % 2];
sav = (double)vecv[index2][index % 2] / (double)vect[index2][index % 2];
if(sav > maxi){
maxi = sav;
}
}
}
fout << maxi;
return 0;
}