Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7627321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:26:36+00:00 2026-05-31T05:26:36+00:00

I’ve started a little side project to try to learn a few new concepts

  • 0

I’ve started a little side project to try to learn a few new concepts (hopefully in C++ or Python) and I was just hoping for a little help with the start of my idea.

*This is all related to a bigger fantasy basketball project, but I have to start somewhere.

I want to 100 variables (players) and find every combination of 10, that satisfies another condition.

For example; I have 100 players, and I want to find out how many combinations of 10 (no duplicates, and order does not matter (so ABC == CBA), will combine for a certain value (170 pts between the 10), or higher.

I assume there’s a Python library to work this magic for me (which I would love to know about), but really, I’m more interested in how I would go about this using C++.

Thanks for any responses.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:26:37+00:00Added an answer on May 31, 2026 at 5:26 am

    Here is some psuedo-code

    function player_combos(array players, int minimum_total) {
      array result = []
      players = sort(players, metric=most points first)
      int total = 0
      for p1 in 0 .. length(players) {
        if players[p1].points*10 < minimum_total - total:
          break
        total += players[p1].points
        for p2 in p1+1 .. length(players) {
          if players[p2].points*9 < minimum_total - total:
            break
          total += players[p2].points
          for p3 in p2+1 .. length(players) {
            if players[p3].points*8 < minimum_total - total:
              break
            total += players[p3].points
            # continue these nested loops up to p10
            ...
                        for p10 in p9+1 .. length(players):
                          if players[p10].points < mininum_total - total:
                            break
                          # this is a valid combination
                          result.append((p1, p2, p3, p4, p5, p6, p7, p8, p9, p10))
            ...
            # remember to decrement total when we finish a loop iteration
            total -= players[p3].points
          }
          total -= players[p2].points
        }
        total -= players[p1].points
      }
      return result
    }
    

    The idea here is that because you have the players sorted first, at any point while looping over players in the list, all players after must have an equal or lower point total as the current player. This allows you to break out of the current loop if the current player’s points multiplied by the number of remaining spots left on the team is less than the number of points required to meet the minimum.

    For example say you have four players on the team so far with 80 points total, that means you have 90 points left to reach the minimum, and there are 6 spots left. The absolute minimum number of points that your next player can have is 15 (since 90 / 6 == 15), so as soon as you reach a player in next loop that has 14 or fewer points, you can break out of that loop.

    This should drastically reduce the total number of combinations you need to get, as long as your minimum_total metric is set high enough.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.