Problem 1001 ΪʲôһֱTLE

8063012 | 2016-05-15 00:56:53Author
ÄѵÀ²»ÊÇÏ߶ÎÊ÷Â𡣡£¡£¡£¡£Çó½â¡£¡£¡£¡£¡£a,b>lenµÄÇé¿öÊä³öÁËÉÏÒ»¸ö´ð°¸ »¹ÊÇTLEѽ
bsblcc | 2016-05-15 01:20:40# 1
cinЧÂÊÂý?
8063012 | 2016-05-15 01:25:59# 2
ÓõÄscanfѽ
csjqing | 2016-05-15 10:45:18# 3
1001ʵÔÚÕÒ²»µ½ÓÅ»¯µÄ·½·¨ÁËÇó´óÉñ°ï°ïæ
#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 ; }