相关文章推荐
强悍的太阳  ·  android intent ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Maybe someone could help and convert this code from python to c# or java? :/ Or knows where I could find online converter.

def findWay(N):
    S = [1,3,4] 
    partial_sums = [ [[k], k] for k in S if k <= N ] 
    total_sums = [ [k] for k in S if k == N ] 
    for _ in range(N): 
        new_sums = []
        for (l, sum) in partial_sums:
            for k in S:
                if sum+k < N:
                    new_sums.append([l+[k], sum+k])
                elif sum+k == N:
                    total_sums.append(l+[k])
        partial_sums = new_sums
    return total_sums
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.