2001 LSU Computer Science High School Programming Contest

Sponsored by Texas Instruments

Novice - Problem 5, Solution in c

/*
	Pasquale's Triangle
*/

#include <stdio.h>

#define MAX 40

int main(void)
{
   int i, sets, count, j, k = 1, num_pas, pasquale[MAX];

        scanf(" %d", &count);

        for(i = 0; i < count; i++)
         {
             scanf(" %d", &num_pas);
             for(j = 0; j < num_pas; j++)
              scanf(" %d",&pasquale[j]);

             k = 1;

             while(k < num_pas)
             {
               for(j = num_pas -k ; j > 0; j--)
                pasquale[j-1] = pasquale[j] + pasquale[j-1];
               k++;
              }  //while

             printf("%d\n",pasquale[0]);

        }    // for i < count


   return 0;
}



Return to Problem Index


 

The statements and opinions included in these pages are those of 2001 LSU Computer Science High School Programming Contest only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 2000,2001 Isaac Traxler
Last modified: Friday, 01 July, 2011 16:27:53