Computer Programming Contest Preparation

ToolBox - Source for: 100/10071/a.c



/home/toolbox/public_html/solutions/100/10071/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: 2014-10-27
   18  * Purpose: fun
   19  * Problem: 10071 - Back to High School Physics
   20  */
   21 
   22 /*
   23  * This template reads data until a terminating value is reached.
   24  */
   25 
   26 int a;
   27 int b;
   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     if (feof(stdin))
   45         dataReadFlag = FALSE;
   46     else
   47         {
   48             /* something to read */
   49             dataReadFlag = TRUE;
   50             scanf(" %d %d ", &a, &b);
   51         } /* something to read */
   52     return (dataReadFlag);
   53 } /* FUNCTION getInput */
   54 
   55 void process()
   56 {
   57     /* FUNCTION process */
   58     int t;
   59 
   60     t = a * b * 2;
   61     printf("%d\n", t);
   62 } /* FUNCTION process */
   63 
   64 int main ()
   65 {
   66     /* main */
   67     int moreToDo;
   68 
   69     init();
   70     moreToDo = getInput();
   71     while (moreToDo)
   72         {
   73             /* while */
   74             process();
   75             moreToDo = getInput();
   76         } /* while */
   77 
   78     return EXIT_SUCCESS;
   79 } /* main */
   80