Social Icons

Thursday, November 26, 2015

Solve of UVA 12602: Nice Licence Plates

Solve of UVA 12602: Nice Licence Plates


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,d,e,f;
    char x[3]={'\0'},z;
    cin>>a;

    while(a--)
    {
        scanf("%3s-%lld",x,&b);
        c=(x[0]-65)*676 + (x[1]-65)*26 + (x[2]-65)*1;
        d=c-b;

        if(d<0) d*=-1;
        if(d<=100) cout<<"nice"<<endl;
        else cout<<"not nice"<<endl;
    }
    return 0;
}

No comments:

Post a Comment

 

Sample text

Sample Text

 
Blogger Templates