View Code of Problem 61

#include<stdio.h>
int main()
{
  int t,n,i,a[100],min,max;
  int f;
  scanf("%d",&t);
  while(t--)
  {   
     scanf("%d",&n);
     for(i=0;i<n;i++)
     {
       scanf("%d",&a[i]);
     }
     f=n;max=a[0]*n;
     for(i=0;i<n-1;i++)
     {
     	if(a[i]*f<a[i+1]*(f-1))
     	 max=a[i+1]*(f-1);
     	 f=f-1;
	 }
    printf("%d\n",max);
   }
    return 0;
}

Double click to view unformatted code.


Back to problem 61