Computer Programming Contest Preparation

ToolBox - Source for: 118/11875/a.c



/home/toolbox/public_html/solutions/118/11875/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: 2016-10-04
   20  * Purpose: fun
   21  * Problem: 11875 - Brick Game
   22  */
   23 
   24 /*
   25  * This template reads data a specified number of times.
   26  */
   27 
   28 int numberOfTimes;
   29 
   30 void init()
   31 {
   32     /* FUNCTION init */
   33     scanf("%d ", &numberOfTimes);
   34 } /* FUNCTION init */
   35 
   36 void dump()
   37 {
   38     /* FUNCTION dump */
   39 } /* FUNCTION dump */
   40 
   41 void getInput()
   42 {
   43     /* FUNCTION getInput */
   44     int i;
   45     int cnt;
   46     int goal;
   47     int num;
   48 
   49     scanf(" %d ", &cnt);
   50     goal = cnt / 2;
   51     for (i=0; i<cnt; i++)
   52         {
   53             /* read each age */
   54             scanf(" %d ", &num);
   55             if (i == goal)
   56                 {
   57                     printf("%d\n", num);
   58                 }
   59         } /* read each age */
   60 
   61 } /* FUNCTION getInput */
   62 
   63 void process()
   64 {
   65     /* FUNCTION process */
   66 } /* FUNCTION process */
   67 
   68 int main()
   69 {
   70     /* main */
   71     int i;
   72 
   73     init();
   74     for (i=1; i<=numberOfTimes; i++)
   75         {
   76             /* while */
   77             printf("Case %d: ", i);
   78             getInput();
   79             process();
   80         } /* while */
   81 
   82     return EXIT_SUCCESS;
   83 } /* main */
   84 
   85