Can you give an insight to what exactly this code does? That may help quiet
a lot.



Regards,
Sandeep Jain




On Sun, Jul 3, 2011 at 1:17 PM, rajeevrvis <rajeev.open.1...@gmail.com>wrote:

> Hi Here is the code  . I want to optimize it to run faster .
> Can Anyone help me???
>
> #include<stdio.h>
> void main()
> {
>  int n,q,a[100000]={0},b[100000],c[100000],d[100000],i,count,j;
>  scanf("%d%d",&n,&q);
>  for(i=0;i<q;i++) scanf("%d%d%d",&b[i],&c[i],&d[i]);
>  for(i=0;i<q;i++)
>   if(b[i]==0)
>   {
>    for(j=c[i];j<=d[i];j++)
>     a[j]=a[j]+1;
>   }
>    else
>    {
>     count =0;
>     for(j=c[i];j<=d[i];j++)
>      if(a[j]%3==0)
>       count++;
>     printf("%d\n",count);
>     }
>    }
>
>  Regards
>
> rajeevrvis
>
> --
> 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