... HAVE U TRIED .... AT LEAST 3 TIMES ... OK U CAN SEE THIS ...

Monday, December 30, 2013

UVA-12614 :: Earn For Future

#include <bits/stdc++.h>
using namespace std ;

int a[100000] , n ,ret ;

int call (int p ,int q )
{
    if (p>q) return ret ;
    ret=max(ret,a[p]) ;

    return call (p+1,q) ;
}

int main()
{
    int t , i ,j ;
    cin>>t ;
    for (i=1 ; i<=t ; i++)
    {
         ret=0 ;
        cin>>n ;
        for (j=1 ; j<=n ; j++) cin>>a[j] ;
        cout<<"Case "<<i<<": "<<call(1,n)<<endl ;
    }

    return 0 ;
}