Computer Programming Contest Preparation

ToolBox - Source for: 2/291/a.c



/home/toolbox/public_html/solutions/2/291/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 #include <ctype.h>
   10 
   11 #define TRUE  (1 == 1)
   12 #define FALSE (1 != 1)
   13 
   14 #define DEBUG if (FALSE)
   15 
   16 /*
   17  *  Author: Isaac Traxler
   18  *    Date:
   19  * Purpose: fun
   20  * Problem:
   21  */
   22 /*                1234567890123456789012345 */
   23 #define ALLONES 0b1111111111111111111111111
   24 #define     MAP 0b0111110100110111010110110
   25 
   26 /* map is the default map for the santa clause tree
   27  * (the result of starting with an empty map and adding each route)
   28  * this ws done for speed
   29  */
   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 setPath(int map, int row, int col)
   42 {
   43     /* FUNCTION setPath */
   44     int tmp;
   45     int num;
   46 
   47     tmp = (row-1) * 5 + col - 1;
   48     num = 1<<tmp;
   49     map = map | num;
   50     return map;
   51 } /* FUNCTION setPath */
   52 
   53 int clearPath(int map, int row, int col)
   54 {
   55     /* FUNCTION clearPath */
   56     int tmp;
   57 
   58     tmp = (row-1) * 5 + col - 1;
   59     map = ALL_ONES - (1<<tmp);
   60     return map;
   61 } /* FUNCTION clearPath */
   62 
   63 
   64 void process()
   65 {
   66     /* FUNCTION process */
   67     int map;
   68 
   69     map = MAP;
   70     do (i=2; 6>i; i++)
   71         {
   72             /* try each possible move from location 1 */
   73             if move(1, i)
   74             } /* try each possible move from location 1 */
   75 } /* FUNCTION process */
   76 
   77 int main()
   78 {
   79     /* main */
   80 
   81     init();
   82     process();
   83 
   84     return EXIT_SUCCESS;
   85 } /* main */
   86