Computer Programming Contest Preparation

ToolBox - Source for: 131/13148/a.c



/home/toolbox/public_html/solutions/131/13148/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 <stdint.h>
    7 #include <math.h>
    8 #include <stdlib.h>
    9 
   10 #define TRUE  (1 == 1)
   11 #define FALSE (1 != 1)
   12 
   13 #define DEBUG if (FALSE)
   14 
   15 /*
   16  *  Author: Isaac Traxler
   17  *    Date: 2018-10-31
   18  * Purpose: fun
   19  * Problem: 13148
   20  */
   21 
   22 /*
   23  * This template reads data until a terminating value is reached.
   24  */
   25 
   26 long special[21] = {1, 64, 729, 4096, 15625, 46656, 117649, 262144, 531441, 1000000, 1771561, 2985984, 4826809, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 85766121};
   27 long num;
   28 
   29 void init()
   30 {
   31     /* FUNCTION init */
   32 } /* FUNCTION init */
   33 
   34 void dump()
   35 {
   36     /* FUNCTION dump */
   37 } /* FUNCTION dump */
   38 
   39 int getInput()
   40 {
   41     /* FUNCTION getInput */
   42     int dataReadFlag;
   43 
   44     scanf(" %ld ", &num);
   45     dataReadFlag = (0 != num);
   46     return (dataReadFlag);
   47 } /* FUNCTION getInput */
   48 
   49 void process()
   50 {
   51     /* FUNCTION process */
   52     int i;
   53     int found = FALSE;
   54 
   55     for (i=0; 21>i; i++)
   56         {
   57             /* for each possible answer */
   58             if (num == special[i])
   59                 {
   60                     /* found a match */
   61                     found = TRUE;
   62                     i = 22;
   63                 } /* found a match */
   64         } /* for each possible answer */
   65     if (found)
   66         printf("Special\n");
   67     else
   68         printf("Ordinary\n");
   69 } /* FUNCTION process */
   70 
   71 int main()
   72 {
   73     /* main */
   74     int moreToDo;
   75 
   76     init();
   77     moreToDo = getInput();
   78     while (moreToDo)
   79         {
   80             /* while */
   81             process();
   82             moreToDo = getInput();
   83         } /* while */
   84 
   85     return EXIT_SUCCESS;
   86 } /* main */
   87