Computer Programming Contest Preparation

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



/home/toolbox/public_html/solutions/127/12704/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: 2015-10-01
   20  * Purpose: fun
   21  * Problem: 12704 - Little Masters
   22  */
   23 
   24 /*
   25  * This template reads data a specified number of times.
   26  */
   27 
   28 int numberOfTimes;
   29 double x;
   30 double y;
   31 double r;
   32 
   33 void init()
   34 {
   35     /* FUNCTION init */
   36     scanf("%d ", &numberOfTimes);
   37 } /* FUNCTION init */
   38 
   39 void dump()
   40 {
   41     /* FUNCTION dump */
   42 } /* FUNCTION dump */
   43 
   44 void getInput()
   45 {
   46     /* FUNCTION getInput */
   47     scanf(" %lf %lf %lf ", &x, &y, &r);
   48 } /* FUNCTION getInput */
   49 
   50 void process()
   51 {
   52     /* FUNCTION process */
   53     double tmp;
   54 
   55     tmp = sqrt(x*x + y*y);
   56     printf("%.2lf %.2lf\n", (r-tmp), (r+tmp));
   57 } /* FUNCTION process */
   58 
   59 int main()
   60 {
   61     /* main */
   62     int i;
   63 
   64     init();
   65     for (i=0; i<numberOfTimes; i++)
   66         {
   67             /* while */
   68             getInput();
   69             process();
   70         } /* while */
   71 
   72     return EXIT_SUCCESS;
   73 } /* main */
   74 
   75