Cod sursa(job #205603)

Utilizator mordredSimionescu Andrei mordred Data 2 septembrie 2008 00:41:50
Problema Secventa 3 Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.76 kb
#include <stdio.h>
#include <string.h>
#define nmax 30001
unsigned int n,l,u,c[nmax],t[nmax],i,j,max;
 
int main(){
 freopen("secv3.in","r",stdin);
 freopen("secv3.out","w",stdout);
 
 scanf("%d %d %d\n",&n,&l,&u);
 
 for(i=1;i<=n;++i)scanf("%d",&c[i]),c[i]+=c[i-1];
 for(i=1;i<=n;++i)scanf("%d",&t[i]),t[i]+=t[i-1];
 
 if(n<9000)
    {
    for(i=l;i<=u;++i)
    for(j=i;j<=n;++j)
        if( ((c[j]-c[j-i])*100) / (t[j]-t[j-i]) > max )
            max = ((c[j]-c[j-i])*100) / (t[j]-t[j-i]);
     
    }
 else
    {
    for(i=l;i<=l+5;++i)
    for(j=i;j<=n;++j)
        if( ((c[j]-c[j-i])*100) / (t[j]-t[j-i]) > max )
            max = ((c[j]-c[j-i])*100) / (t[j]-t[j-i]);
    }
             
 printf("%d.%02d",max/100,max%100);
 
 return 0;
}