Computer Programming Contest Preparation

ToolBox - Source for: 127/12791/a.c



/home/toolbox/public_html/solutions/127/12791/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: 2015-09-29
   18  * Purpose: fun
   19  * Problem: 12791
   20  */
   21 
   22 /*
   23  * This template reads data until a terminating value is reached.
   24  */
   25 
   26 
   27 
   28 int x;
   29 int y;
   30 
   31 
   32 void init()
   33 {
   34     /* FUNCTION init */
   35 } /* FUNCTION init */
   36 
   37 void dump()
   38 {
   39     /* FUNCTION dump */
   40 } /* FUNCTION dump */
   41 
   42 int getInput()
   43 {
   44     /* FUNCTION getInput */
   45     int dataReadFlag;
   46 
   47     dataReadFlag = (2 == scanf(" %d %d ", &x, &y));
   48     return (dataReadFlag);
   49 } /* FUNCTION getInput */
   50 
   51 void process()
   52 {
   53     /* FUNCTION process */
   54     int xl = 0;
   55     double yl = 0;
   56 
   57     while ((xl - 1) < yl)
   58         {
   59             /* while */
   60             xl = xl + 1;
   61             yl = yl + (x / ((double) y));
   62         } /* while */
   63 
   64     printf("%d\n", xl);
   65 } /* FUNCTION process */
   66 
   67 int main()
   68 {
   69     /* main */
   70     int moreToDo;
   71 
   72     init();
   73     moreToDo = getInput();
   74     while (moreToDo)
   75         {
   76             /* while */
   77             process();
   78             moreToDo = getInput();
   79         } /* while */
   80 
   81     return EXIT_SUCCESS;
   82 } /* main */
   83