文章

39

粉丝

45

获赞

0

访问

7.5k

头像
字符值 题解:c
P1870 云南大学机试题
发布于2024年3月13日 15:59
阅读数 186

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

int main()
{
    char s[10000];
    scanf("%s",&s);
    int n;
    scanf("%d",&n);
    while(n--){
        int l,r;
        int sum=0;
        scanf("%d %d",&l,&r);
        for(int i=l-1;i<=r-1;i++){
            sum+=s[i];
        }
        printf("%d\n",sum);

    }

    return 0;
}

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发