#7900: why?TLE


cuh127 (futurhack~~~~~興國猩國也(絕對沒有在污辱女性))


#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
int a,b,c,d,e,f,i,j;
int x[100002]={};
while(scanf("%d%d",&a,&b)!=EOF)
{for(i=1;i<=a;i++)
{scanf("%d",&x[i]);
}
for(j=0;j<b;j++)
{f=0;
scanf("%d%d",&c,&d);
for(e=c;e<=d;i++)
{f=f+x[i];
}
printf("%d\n",f);
}
}
return 0;
}
#7905: Re:why?TLE


pcshic (PCSHIC)


一句話

方法太慢‧想一下別的解法吧!

#8268: Re:why?TLE


Leroi (醫官也會寫程式)


提示:
Si~f=Sf-Si-1
#8292: Re:why?TLE


chenzhao (nothing)


DP的感觉 不要再慢慢加了...