I create some macros like this:

#define R(i,a,b) for(i=a;i<b;i++)
#define D(i,a,b) for(i=a;i>=b;i--)
#define I(d) scanf("%d",&d);



But i don't get the accepted in this problem!





On Sun, Mar 6, 2011 at 1:55 PM, Logic King <crazy.logic.k...@gmail.com>wrote:

> i solved the problem on spoj based on DP i am getting the solution right
> but i am exceeding the following restriction
> "Take care about your fingers, do not use more than *256* bytes of code."
>
> http://www.spoj.pl/problems/SUMITR/
>
>
> My code is--
>
> #include<stdio.h>
> int arr[100][100];
> int main()
> {
>     int tc,n,max,i,j;
>     scanf("%d",&tc);
>     while(tc--)
>     {
>         scanf("%d",&n);
>         for(i=0;i<n;i++)
>         {
>             for(j=0;j<=i;j++)
>                 scanf("%d",&arr[i][j]);
>         }
>     for(i=n-2;i>=0;i--)
>     {
>         for(j=0;j<=i;j++)
>         {
>
>             max=(arr[i+1][j]>arr[i+1][j+1])?arr[i+1][j]:arr[i+1][j+1];
>         arr[i][j]=arr[i][j]+max;
>         }
>     }
>         printf("%d\n",arr[0][0]);
>     }
> return 0;
> }
>
>
> how can i reduce my my code length so that it doesn't exceed 256
> bytes....pl help !!
>
> --
> 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