Computer Programming Contest Preparation

ToolBox - Source for: 126/12602/a.c



/home/toolbox/public_html/solutions/126/12602/a.c
    1 #include <stdio.h>
    2 #include <string.h>
    3 #include <sys/types.h>
    4 #include <sys/stat.h>
    5 #include <fcntl.h>
    6 #include <stdlib.h>
    7 #include <math.h>
    8 #include <stdint.h>
    9 
   10 #define TRUE  (1 == 1)
   11 #define FALSE (1 != 1)
   12 
   13 #define DEBUG if (FALSE)
   14 
   15 /* fprintf(stderr, "functionName: message", varslist); */
   16 
   17 /*
   18  *  Author: Isaac Traxler
   19  *    Date: 2015-10-03
   20  * Purpose: fun
   21  * Problem: 12602 - Nice Licence Plates
   22  */
   23 
   24 /*
   25  * This template reads data a specified number of times.
   26  */
   27 
   28 int numberOfTimes;
   29 char buff[10];
   30 int p1;
   31 int p2;
   32 
   33 void init()
   34 {
   35     /* FUNCTION init */
   36     scanf("%d ", &numberOfTimes);
   37 } /* FUNCTION init */
   38 
   39 void dump()
   40 {
   41     /* FUNCTION dump */
   42 } /* FUNCTION dump */
   43 
   44 void getInput()
   45 {
   46     /* FUNCTION getInput */
   47     scanf(" %s ", buff);
   48 } /* FUNCTION getInput */
   49 
   50 void process()
   51 {
   52     /* FUNCTION process */
   53     p1 = (buff[0]-'A')*26*26 + (buff[1]-'A')*26 + buff[2]-'A';
   54     p2 = (buff[4]-'0')*1000 + (buff[5]-'0')*100 + (buff[6]-'0')*10 + (buff[7]-'0');
   55     if ((100 < (p1 - p2)) || (100 < (p2 - p1)))
   56         {
   57             printf("not ");
   58         }
   59     printf("nice\n");
   60 } /* FUNCTION process */
   61 
   62 int main()
   63 {
   64     /* main */
   65     int i;
   66 
   67     init();
   68     for (i=0; i<numberOfTimes; i++)
   69         {
   70             /* while */
   71             getInput();
   72             process();
   73         } /* while */
   74 
   75     return EXIT_SUCCESS;
   76 } /* main */
   77 
   78