Computer Programming Contest Preparation

ToolBox - Source for: 126/12658/a.c



/home/toolbox/public_html/solutions/126/12658/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 char buff[81];
   16 
   17 /*
   18  *  Author: Isaac Traxler
   19  *    Date: 2015-10-18
   20  * Purpose: fun
   21  * Problem: 12568
   22  */
   23 
   24 
   25 void init()
   26 {
   27     /* FUNCTION init */
   28 } /* FUNCTION init */
   29 
   30 void dump()
   31 {
   32     /* FUNCTION dump */
   33 } /* FUNCTION dump */
   34 
   35 void process()
   36 {
   37     /* FUNCTION process */
   38     int cnt;
   39     int val[11] = {0};
   40     int i;
   41 
   42     scanf(" %d ", &cnt);
   43     fgets(buff, 80, stdin);
   44     fgets(buff, 80, stdin);
   45     fgets(buff, 80, stdin);
   46     fgets(buff, 80, stdin);
   47     for (i=0; i<cnt; i++)
   48         {
   49             /* 4th line is unique for each value */
   50             if ('*' == buff[i*4])
   51                 {
   52                     val[i] = 2;
   53                 }
   54             else if ('*' == buff[i*4+1])
   55                 {
   56                     val[i] = 1;
   57                 }
   58             else
   59                 {
   60                     val[i] = 3;
   61                 }
   62         } /* 4th line is unique for each value */
   63     for (i=0; i<cnt; i++)
   64         {
   65             /* print each number */
   66             printf("%d", val[i]);
   67         } /* print each number */
   68     printf("\n");
   69 
   70 } /* FUNCTION process */
   71 
   72 int main()
   73 {
   74     /* main */
   75 
   76     process();
   77 
   78     return EXIT_SUCCESS;
   79 } /* main */
   80