Cod sursa(job #82756)

Utilizator gabitzish1Gabriel Bitis gabitzish1 Data 8 septembrie 2007 23:40:34
Problema Secventa 3 Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.69 kb
#include<stdio.h>


int n, l, u;
double first[3000], last[300], all[3000], maxim, x, tot;

void citire()
{
  long long i;
  freopen("secv3.in","r",stdin);
  freopen("secv3.out","w",stdout);
  scanf("%d %d %d",&n,&l,&u);
  for (i=1; i<=n; i++) scanf("%lf",&all[i]);

  for ( i=1; i<=n; i++)
    {
      scanf("%lf",&x);
      all[i]/=x;
    }

  first[1]=all[1];
  for (i=2; i<=n; i++) first[i]=first[i-1]*all[i];
  tot=first[n];
  last[n]=all[n];
  for (i=n-1; i>=1; i--) last[i]=last[i+1]*all[i];

  for (i=1; i<n; i++)
    {
      if (first[i]>tot)
	if (last[i+1]>maxim) {maxim=last[i+1];}
    }

  printf("%.2lf",maxim);
}

int main()
{
  citire();
  return 0;
}