【题目链接】http://www.ifrog.cc/acm/problem/1005

【题意】就是把字符串,按照题上规则转成整数,并且对101取模。

【AC 代码】

//
//Created by just_sort 2016/9/25 21:03
//Copyright (c) 2016 just_sort.All Rights Reserved
//

#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int mod = 101;
int a[27];
char s[1010];
int main()
{
    for(int i=1; i<=26; i++) a[i] = i*i;
    int T;
    scanf("%d",&T);
    while(T--){
        scanf("%s",s);
        int ans = 0;
        int len = strlen(s);
        for(int i=0; i<len; i++){
            string temp = "";
            int x = a[s[i]-'a'+1];
            while(x){
                temp += x%10+'0';
                x /= 10;
            }
            reverse(temp.begin(),temp.end());
            for(int j=0; temp[j]; j++){
                ans = (ans*10 + temp[j]-'0')%mod;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}