logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Your task is to help Finn determine the number of ways that a number can be written as a sum of fours and fives.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Problem 1: Good Fours and Good Fives

Problem Description

Finn loves Fours and Fives. In fact, he loves them so much that he wants to know the number of ways a number can be formed by using a sum of fours and fives, where the order of the fours and fives does not matter. If Finn wants to form the number 14, there is one way to do this which is 14 = 4 + 5 + 5. As another example, if Finn wants to form the number 20, this can be done two ways, which are 20 = 4 + 4 + 4 + 4 + 4 and 20 = 5 + 5 + 5 + 5. As a final

example, Finn can form the number 40 in three ways:  40 = 4 +4 +4 +4 +4 +4 +4 +4 +4 +4,

40 = 4 + 4 + 4 + 4 + 4 + 5 + 5 + 5 + 5, and 40 = 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5.

Your task is to help Finn determine the number of ways that a number can be written as a sum of fours and fives.

 

Input Specification

The input consists of one line containing a number N .

The following table shows how the available 15 marks are distributed.

 

Marks Awarded Bounds on N Additional Constraints

3 marks 1 ≤ N ≤ 10 None

2 marks 1 ≤ N ≤ 100 000 N is a multiple of 4

2 marks 1 ≤ N ≤ 100 000 N is a multiple of 5

8 marks 1 ≤ N ≤ 1 000 000 None

 

Output Specification

Output the number of unordered sums of fours and fives which form the number N .  Output

0 if there are no such sums of fours and fives.

 

Sample Input 1

14

 

Output for Sample Input 1

1

 

Explanation of Output for Sample Input 1

This is one of the examples in the problem description.

Sample Input 2

40

Output for Sample Input 2

3

 Explanation of Output for Sample Input 2

This is one of the examples in the problem description.

 

Sample Input 3

6

 

Output for Sample Input 3

0

Explanation of Output for Sample Input 3

There is no way to use a sum of fours and fives to get 6.

 Problème S1 : Des quatre et des cinq

Énoncé du problème

François adore les chiffres quatre et cinq. En fait, il les aime tellement qu’il veut savoir de combien de façons un nombre peut être formé en additionnant des quatre et des cinq (l’ordre des chiffres n’ayant pas d’importance). Si François veut former le nombre 14, il existe une façon de le faire, à savoir 14 = 4 + 5 + 5. À titre de deuxième exemple, si François veut former le nombre 20, il peut le faire de deux façons : 20  = 4 + 4 + 4 + 4 + 4 et 20 = 5 + 5 + 5 + 5. Enfin, François peut former le nombre 40 de trois façons différentes : 40 = 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4, 40 = 4 + 4 + 4 + 4 + 4 + 5 + 5 + 5 + 5 et

40 = 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5.

Votre tâche consiste à aider François à déterminer le nombre de façons dont un nombre peut être exprimé sous la forme d’une somme des chiffres quatre et cinq.

Précisions par rapport aux données d’entrée

Les données d’entrée ne contiennent qu’une seule ligne. Cette ligne ne contient qu’un nombre

N .

Le tableau suivant indique la manière dont les 15 points disponibles sont répartis.

Attribution

des points Intervalle dans

lequel N est compris Restrictions

additionnelles

3 points 1 ≤ N ≤ 10 Aucune

2 points 1 ≤ N ≤ 100 000 N est un multiple de 4

2 points 1 ≤ N ≤ 100 000 N est un multiple de 5

8 points N ≤ 1 000 000 Aucune

Précisios par rapport aux données de sortie

Les données de sortie devraient afficher le nombre de façons dont le nombre N peut être exprimé sous la forme d’une somme (non-ordonnée) des chiffres quatre et cinq. Les données de sortie devraient afficher 0 s’il n’existe aucune façon d’exprimer le nombre N sous la forme d’une somme des chiffres quatre et cinq.

Données d’entrée d’un 1er exemple

14

Données de sortie du 1er exemple

1

Justification des données de sortie du 1er exemple

Cet exemple figure dans l’énoncé du problème.

 Données d’entrée d’un 2e exemple

40

Données de sortie du 2e exemple

3

Justification des données de sortie du 2e exemple

Cet exemple figure dans l’énoncé du problème.

Données d’entrée d’un 3e exemple

6

Données de sortie du 3e exemple

0

Justification des données de sortie du 3e exemple

Il n’existe aucune façon d’exprimer le nombre 6 sous la forme d’une somme des chiffres quatre et cinq.

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

662 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

817 Answers

Hire Me
expert
Husnain SaeedComputer science

593 Answers

Hire Me
expert
Atharva PatilComputer science

916 Answers

Hire Me

Get Free Quote!

365 Experts Online