Computer Programming Contest Preparation

ToolBox - Source for: 105/10533/b.c



/home/toolbox/public_html/solutions/105/10533/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 <stdlib.h>
    7 #include <math.h>
    8 #include <stdint.h>
    9 #include <ctype.h>
   10 
   11 #define TRUE  (1 == 1)
   12 #define FALSE (1 != 1)
   13 
   14 #define DEBUG if (FALSE)
   15 
   16 /* fprintf(stderr, "functionName: message", varslist); */
   17 
   18 /*
   19  *  Author: Isaac Traxler
   20  *    Date: 10-19-2021
   21  * Purpose: fun
   22  * Problem: 10533 - Digit Primes
   23  */
   24 
   25 /*
   26  * This template reads data a specified number of times.
   27  */
   28 
   29 int numberOfTimes;
   30 
   31 #define MAX_SIZE 1000000
   32 
   33 int num;
   34 int primes[MAX_SIZE];
   35 
   36 void init()
   37 {
   38     /* FUNCTION init */
   39     int i;
   40     int j;
   41 
   42     numPrimes = 0;
   43     primes[0] = 0;
   44     primes[1] = 0;
   45 
   46     /* sieve of erasthones */
   47     for (i=2; i<MAX_SIZE; i=i+1)
   48         {
   49             primes[i]=i;
   50         }
   51     for (i=3; i<MAX_SIZE; i=i+1)
   52         {
   53             /* loop through primes */
   54             if (0 != primes[i])
   55                 {
   56                     /* found a prime */
   57                     primes[numPrimes] = primes[i];
   58                     for (j=i+primes[i]; j<MAX_SIZE; j=j+primes[i])
   59                         {
   60                             /* mark out multiples */
   61                             primes[j] = 0;
   62                         } /* mark out multiples */
   63                 } /* found a prime */
   64         } /* loop through primes */
   65     printf("NUmber of primes %d\n", numPrimes);
   66     scanf("%d ", &numberOfTimes);
   67     numDigitPrimes=0;
   68     digitPrimes[0] =
   69         for (i=0; numPrimes>i; i++,numDigitPrimes++)
   70         {
   71             /* for each prime */
   72         } /* for each prime */
   73 } /* FUNCTION init */
   74 
   75 void dump()
   76 {
   77     /* FUNCTION dump */
   78 } /* FUNCTION dump */
   79 
   80 void getInput()
   81 {
   82     /* FUNCTION getInput */
   83 } /* FUNCTION getInput */
   84 
   85 void process()
   86 {
   87     /* FUNCTION process */
   88 } /* FUNCTION process */
   89 
   90 int main()
   91 {
   92     /* main */
   93     int i;
   94 
   95     init();
   96     for (i=0; i<numberOfTimes; i++)
   97         {
   98             /* while */
   99             getInput();
  100             process();
  101         } /* while */
  102 
  103     return EXIT_SUCCESS;
  104 } /* main */
  105 
  106