Giter Club home page Giter Club logo

algorithm's Introduction

We want to know how many different ways exist to obtain certain integer number as a sum of smaller positive numbers, taking into account a certain list of numbers that cannot be used.

Considerations

• If A + B = B + A, only one of them should be indicated

• In addition, A > 0 and B > 0

Input:

Each case is described in one line with an integer number X, which is the value to obtain, and a list of M positive numbers N0, N1 ... NM-1 separated by a space. These values cannot be used as operands.

Output:

For each case T, the output must be the string "#t:" followed by the total number of possible ways. For example:

Sample input:

3 1

6 1 3

Sample output:

#1: 0

#2: 2

In the first case (3), there is no way to get 3 from 1 and 2 without using operand 1. The second case (6) can be calculated with operations 2 + 2 + 2 and 4 + 2, so there are 2 possible ways without using operands 1 and 3.

algorithm's People

Contributors

ilya449 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.