Giter Site home page Giter Site logo

possiblenumberofpies's Introduction

PossibleNumberOfPies

https://www.reddit.com/r/dailyprogrammer/comments/87rz8c/20180328_challenge_355_intermediate_possible/

It's Thanksgiving eve and you're expecting guests over for dinner tomorrow. Unfortunately, you were browsing memes all day and cannot go outside to buy the ingredients needed to make your famous pies. You find some spare ingredients, and make do with what you have. You know only two pie recipes, and they are as follows:

Pumpkin Pie

  • 1 scoop of synthetic pumpkin flavouring (Hey you're a programmer not a cook)
  • 3 eggs
  • 4 cups of milk
  • 3 cups of sugar

Apple Pie

  • 1 apple
  • 4 eggs
  • 3 cups of milk
  • 2 cups of sugar
    Your guests have no preference of one pie over another, and you want to make the maximum number of (any kind) of pies possible with what you have. You cannot bake fractions of a pie, and cannot use fractions of an ingredient (So no 1/2 cup of sugar or anything like that)

Input Format

You will be given a string of 4 numbers separated by a comma, such as 10,14,10,42,24. Each number is a non-negative integer. The numbers represent the number of synthetic pumpkin flavouring, apples, eggs, milk and sugar you have (In the units represented in the recipes).

For instance, in the example input 10,14,10,42,24, it would mean that you have

10 scoops of synthetic pumpkin flavouring
14 apples
10 eggs
42 cups of milk
24 cups of sugar

Output Format

Display the number of each type of pie you will need to bake. For the example input, an output would be

3 pumpkin pies and 0 apple pies

Challenge Inputs

10,14,10,42,24
12,4,40,30,40
12,14,20,42,24

Challenge Outputs

3 pumpkin pies and 0 apple pies
5 pumpkin pies and 3 apple pies
5 pumpkin pies and 1 apple pies

possiblenumberofpies's People

Contributors

adamfarnsworth avatar

Watchers

James Cloos 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.