using System.Collections.Generic;
public static void Main()
GetScores(new List<int>() { 3,7,8 }, new List<int>(), 0, 13);
private static void GetScores(List<int> scores, List<int> possibleScores, int currentScore, int target) {
if (scores.Count == 0) display(possibleScores);
if (currentScore == target) {
for (int i=0; i<scores.Count; i++) {
possibleScores.Add(score);
GetScores(scores, possibleScores, currentScore, target);
possibleScores.RemoveAt(possibleScores.Count - 1);
private static void display(List<int> possibleScores) {
var sb = new StringBuilder();
foreach (var score in possibleScores) {
sb.Append(score).Append(",");
Console.WriteLine(sb.ToString().TrimEnd(','));