Game Scores - java - USACO Style Question

I was given this problem in a class, and I'm not sure how I'm supposed to approach this.


Game Scores

In a game, there are n rounds. In each round, a player can get m different scores. How many different total scores can a player receive after playing a game?

Input (from terminal / stdin)

The first line has the integers n (n ≤ 10) and m (m ≤ 6). The second line contains the m different scores in each round.

Output (to terminal / stdout)

Report the number of different total scores a player can receive after a game.

Sample input

4 3

1 3 5

Sample output

9

There are 4 rounds in a game and a player receives either 1 point, 3 points, or 5 points in each round. The total score a player receives can be 4, 6, 8, 10, 12, 14, 16, 18, 20. Therefore, a player can get 9 different total scores. The output is 9.


Thanks! (also, why isn't there a tag for competitive programming?)

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum