Problem 1001 一直不明白我下面的代码超时在什么地方

csjqing | 2016-05-15 11:36:28Author
#include<stdio.h> char str[100005]; int Hash(char *s, int a, int b); int main(){ int n,a,b; while(scanf("%d",&n)!=EOF){ scanf("%s", str); while(n--&&n>=0){ scanf("%d%d",&a,&b); printf("%d\n",Hash(str,a-1,b)); } } return 0; } int Hash(char *s, int a, int b){ int i,j; long long sum = 1; for(i=a; i < b; i++){ sum = sum * (s[i]-28); } return sum % 9973 ; }