Tuesday, July 19, 2016

UVA 11530 Solution

Unknown
#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
    int tc,c=1;
    scanf("%d",&tc);
    getchar();
    while (tc--)
    {
        char s[1000];
        gets(s);
        int l=strlen(s);
        int sum=0;
        for (int i=0;i<l;i++)
            switch(s[i])
            {
                case 'b':
                case 'e':
                case 'h':
                case 'k':
                case 'n':
                case 'q':
                case 'u':
                case 'x': sum+=2; break;
                case 'c':
                case 'f':
                case 'i':
                case 'l':
                case 'o':
                case 'r':
                case 'v':
                case 'y': sum+=3; break;
                case 's':
                case 'z': sum+=4; break;
                default : sum+=1; break;
            }
        printf("Case #%d: %d\n",c++,sum);
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,