Sunday, July 17, 2016

UVA 12602 Solution

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

int main()
{
    int tc,a,b,dif;
    char s[10];
    scanf("%d",&tc);
    while (tc--)
    {
        scanf("%s",s);
        a=b=0;
        for ( int i=0;i<3;i++) a=a*26+s[i]-'A';
        for (int i=4;i<8;i++) b=b*10+s[i]-'0';
        if (abs(a-b)<101) printf("nice\n");
        else printf("not nice\n");
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,