FZUOJ-2222-ABCDEFG From 校赛 A

FZUOJ-2222-ABCDEFG From 校赛 A

题目链接
签到题水到爆 直接打

#include"iostream"
#include"cstring"
#include"cstdio"
using namespace std;
int main(){
    int t,i,len,sum;
    int num1[7] = {3,2,1,2,3,3,1};
    int num2[7] = {1,1,1,2,1,2,1};
    char s[150];
    cin>>t;
    getchar();
    while(t--){ 
        cin>>s;
        sum = 0;
        len = strlen(s);
        for(i=0; i<len; i++){
            if(s[i]>='A' && s[i]<='G')
                sum += num1[s[i]-'A'];
            if(s[i]>='a' && s[i]<='g')
                sum += num2[s[i]-'a'];
        }
        cout<<sum<<endl;
    }
    return 0;
} 

你可能感兴趣的:(水,FZU)