Computer Programming Contest Preparation

ToolBox - Source for: 6/674/b.c



/home/toolbox/public_html/solutions/6/674/b.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 /*
   17  *  Author: Isaac Traxler
   18  *    Date: 2015-03-11
   19  * Purpose:
   20  * Problem: 674
   21  */
   22 
   23 /*
   24  * This template reads lines of data at a time until end of file.
   25  */
   26 
   27 int chg;
   28 
   29 void init()
   30 {
   31     /* FUNCTION init */
   32     /*
   33           1  5  10  25  50
   34         1 1  5  10  25  50
   35         5 5  1   0   0   0
   36        10 0  0   1   2   5
   37        25 0  5   2   1   2
   38        50 0 10   5   2   1
   39 
   40          cnt * value
   41        1  1
   42        5  2 5*1 1*5
   43       10  4 10*1 5*1+1*5 2*5 1*10
   44       25 16 25*1 20*1+1*5 15*1+2*5 10*1+3*5 5*1+4*5 5*5 15*1+2*5 15*1+1*10 10*1+3*5 10*1+1*5+1*10 5*1+2*5+1*10 5*1+2*10
   45             5*5 3*5+1*10 1*5+2*10 1*25
   46     */
   47 } /* FUNCTION init */
   48 
   49 void dump()
   50 {
   51     /* FUNCTION dump */
   52 } /* FUNCTION dump */
   53 
   54 int getInput()
   55 {
   56     /* FUNCTION getInput */
   57     int dataReadFlag;
   58 
   59     dataReadFlag = 1 == scanf(" %d ", &chg);;
   60     return (dataReadFlag);
   61 } /* FUNCTION getInput */
   62 
   63 void process()
   64 {
   65     /* FUNCTION process */
   66 } /* FUNCTION process */
   67 
   68 int main()
   69 {
   70     /* main */
   71     int moreToDo;
   72 
   73     init();
   74     moreToDo = getInput();
   75     while (moreToDo)
   76         {
   77             /* while */
   78             process();
   79             moreToDo = getInput();
   80         } /* while */
   81 
   82     return EXIT_SUCCESS;
   83 } /* main */
   84