2014年7月14日 星期一

uva 12602 Nice Licence Plates

按照題目的算法計算即可。


#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void){
    int amount,i;
    char plate[10],c1,c2,c3,c;
    int first,second;

    scanf("%d%c",&amount,&c);
    while(amount--){
        scanf("%c%c%c%c%d%c",&c1,&c2,&c3,&c,&second,&c);
        first=(c1-'A')*26*26+(c2-'A')*26+(c3-'A');

        if(abs(first-second)<=100)
            printf("nice\n");
        else
            printf("not nice\n");
    }

    return 0;
}

沒有留言:

張貼留言