Computer Programming Contest Preparation

ToolBox - Source for: 1/108/b.c



/home/toolbox/public_html/solutions/1/108/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 #define MAX_SIZE 101
   16 
   17 /*
   18  *  Author: Isaac Traxler
   19  *    Date: 2014-10-29
   20  * Purpose: fun
   21  * Problem: 108 - Maximum Sum  - more to be done
   22  */
   23 
   24 /*
   25  * This template reads data until a terminating value is reached.
   26  */
   27 
   28 int dim;
   29 int a[MAX_SIZE][MAX_SIZE];
   30 
   31 void init()
   32 {
   33     /* FUNCTION init */
   34 } /* FUNCTION init */
   35 
   36 void dump()
   37 {
   38     /* FUNCTION dump */
   39 } /* FUNCTION dump */
   40 
   41 int getInput()
   42 {
   43     /* FUNCTION getInput */
   44     int i;
   45     int j;
   46 
   47     scanf(" %d ", &dim);
   48     for (i=0; i<dim; i++)
   49         for (j=0; j<dim; j++)
   50             {
   51                 /* get each value */
   52                 scanf(" %d ", a[i][j]);
   53             } /* get each value */
   54 } /* FUNCTION getInput */
   55 
   56 int findMax(int x1, int x2, int y1, int y2)
   57 {
   58     /* FUNCTION findMax */
   59     int i;
   60     int j;
   61     int tot = 0;
   62 
   63     for (i=x1; i<x2; i++)
   64         for (j=0; j<y2; j++)
   65             {
   66                 /* each cell */
   67                 tot = tot + a[i][j];
   68             } /* each cell */
   69     return tot;
   70 } /* FUNCTION findMax */
   71 
   72 void process()
   73 {
   74     /* FUNCTION process */
   75 } /* FUNCTION process */
   76 
   77 int main ()
   78 {
   79     /* main */
   80     int moreToDo;
   81 
   82     init();
   83     moreToDo = getInput();
   84     while (moreToDo)
   85         {
   86             /* while */
   87             process();
   88             moreToDo = getInput();
   89         } /* while */
   90 
   91     return EXIT_SUCCESS;
   92 } /* main */
   93