launda pelu nikla.....

On Thu, Mar 10, 2011 at 10:22 AM, UTKARSH SRIVASTAV <usrivastav...@gmail.com
> wrote:

> WELL I HAVE DONE THIS PROBLEM .HERE IS THE CODE
> #include<stdio.h>
> #include<algorithm>
> using namespace std;
> main()
> {
>     long long int t[2][2010],price[2010],r,c,i,j,n;
>     scanf("%lld",&n);
>     for(i=0;i<n;i++)
>     {
>         scanf("%lld",&price[i]);
>     }
>     for(r=n-1,c=0;r>=0&&c<=n-1;r--,c++)
>     {
>         for(i=r,j=n-1;i>=0&&j>=c;j--,i--)
>
> t[i&1][j]=max(price[i]*(n+i-j)+t[(i+1)&1][j],price[j]*(n+i-j)+t[i&1][j-1]);
>     }
>     printf("%lld\n",t[0][n-1]);
>     return 0;
>
> }
>
>
>
> On Wed, Mar 9, 2011 at 5:10 PM, Algoose chase <harishp...@gmail.com>wrote:
>
>> Hi,
>>
>> Any solution other than brute force(exponential growth) for this problem ?
>>
>>
>> On Sun, Mar 6, 2011 at 6:42 PM, UTKARSH SRIVASTAV <
>> usrivastav...@gmail.com> wrote:
>>
>>> can anyone please tell me why i am getting wrong answer for
>>> problem.....https://www.spoj.pl/problems/TRT/
>>> .
>>> .
>>> .
>>> MY CODE IS THIS AND TO BE TESTED IN gcc COMPILER
>>>
>>>
>>> #include<stdio.h>
>>> double a[2100];
>>> double fun(long long int  m,long long int n,double count)
>>> {
>>>        double k,l;
>>>        count++;
>>>        if(m==n)
>>>        {
>>>
>>>                return count*a[m];
>>>        }
>>>        if((k=(fun(m+1,n,count)))>(l=(fun(m,n-1,count))))
>>>        {
>>>
>>>                return (count*a[m]+k);
>>>        }
>>>        else
>>>        {
>>>
>>>
>>>                return (count*a[n]+l);
>>>        }
>>> }
>>> int main()
>>> {
>>>        long long int i,m,n;
>>>        double ans,c=0;
>>>        scanf("%lld",&n);
>>>        for(i=1;i<=n;i++)
>>>        {
>>>                scanf("%lf",&a[i]);
>>>        }
>>>        m=1;
>>>        ans=fun(m,n,c);
>>>        printf("%.0lf\n",ans);
>>>        return 0;
>>> }
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> UTKARSH SRIVATAV
> CSE-3
> B-TECH 2nd YEAR
> MNNIT ALLAHABAD
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to