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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to