# include # # include "football_scores.h" # /******************************************************************************/ long long int *football_scores ( int n ) /******************************************************************************/ /* Purpose: football_scores() counts the ways of getting any football score from 0 to 100. Licensing: This code is distributed under the MIT license. Modified: 21 September 2022 Author: John Burkardt Input: int n: the highest score to be considered. Output: long long int football_scores[n+1]: the number of ways of achieving each score from 0 to n. */ { int i; long long int *s; s = ( long long int * ) malloc ( ( n + 1 ) * sizeof ( long long int ) ); for ( i = 0; i <= n; i++ ) { s[i] = 0; if ( i == 0 ) { s[i] = 1; } if ( 1 <= i ) { s[i] = s[i] + s[i-1]; } if ( 2 <= i ) { s[i] = s[i] + s[i-2]; } if ( 3 <= i ) { s[i] = s[i] + s[i-3]; } if ( 6 <= i ) { s[i] = s[i] + s[i-6]; } if ( 7 <= i ) { s[i] = s[i] + s[i-7]; } if ( 8 <= i ) { s[i] = s[i] + s[i-8]; } } return s; }