12602 - Nice Licence Plates

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    char str[10];
    int n,a,t,sum;
    scanf("%d",&t);
    getchar();
    while(t--)
    {
        scanf("%3s-%d",str,&n);
        sum=(str[0]-65)*26*26+(str[1]-65)*26+(str[2]-65);
        a=abs(n-sum);
        if(a<=100)
        {
            printf("nice\n");
        }
        else
        {
            printf("not nice\n");
        }
    }
    return 0;
}

0 comments: (+add yours?)