Computer Programming Contest Preparation

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



/home/toolbox/public_html/solutions/126/12646/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 #include <ctype.h>
   10 
   11 #define TRUE  (1 == 1)
   12 #define FALSE (1 != 1)
   13 
   14 #define DEBUG if (FALSE)
   15 
   16 #define MAX_LINE 257
   17 
   18 /*
   19  *  Author: Isaac Traxler
   20  *    Date: 2021-12-16
   21  * Purpose: fun
   22  * Problem: 12646 - Zero or One
   23  */
   24 
   25 /*
   26  * This template reads lines of data at a time until end of file.
   27  */
   28 
   29 int a;
   30 int b;
   31 int c;
   32 char mat[8] = { '*', 'C', 'B', 'A', 'A', 'B', 'C', '*' };
   33 /*
   34    0 0 0 tie *
   35    0 0 1 c   C
   36    0 1 0 b   B
   37    0 1 1 a   A
   38    1 0 0 a   A
   39    1 0 1 b   B
   40    1 1 0 c   C
   41    1 1 1 tie *
   42  */
   43 
   44 
   45 void init()
   46 {
   47     /* FUNCTION init */
   48 } /* FUNCTION init */
   49 
   50 void dump()
   51 {
   52     /* FUNCTION dump */
   53 } /* FUNCTION dump */
   54 
   55 int getInput()
   56 {
   57     /* FUNCTION getInput */
   58     int dataReadFlag;
   59 
   60     dataReadFlag = (3 == scanf(" %d %d %d ", &a, &b, &c));
   61     return (dataReadFlag);
   62 } /* FUNCTION getInput */
   63 
   64 void process()
   65 {
   66     /* FUNCTION process */
   67     printf("%c\n", mat[(a*4) + (b*2) + c]);
   68 } /* FUNCTION process */
   69 
   70 int main()
   71 {
   72     /* main */
   73     int moreToDo;
   74 
   75     init();
   76     moreToDo = getInput();
   77     while (moreToDo)
   78         {
   79             /* while */
   80             process();
   81             moreToDo = getInput();
   82         } /* while */
   83 
   84     return EXIT_SUCCESS;
   85 } /* main */
   86