programing assignment
programing assignment
Grandma emahoy alemitu wants to tie a scarf for her grandchildren. Every day she ties up a
centimeters of a scarf. However, at night, the kitten wuro unties the b centimeters of a scarf
(b < a).
Since emahoy alemitu loves her grandchildren very much, she wants the scarf to be at least n
centimeters long.
Formally, first, grandma has a scarf with 0 centimeters length. Every day the following
happens:
at the beginning of the day, grandma adds a centimeters to the scarf's length;
if the length of the scarf becomes at least n, then the grandma finishes tieing and gives
the scarf to her grandchildren;
otherwise, at night the kitten reduces the length of the scarf by b centimeters. After
that, a new day will begin and grandma will continue to tie.
For example, if n = 3, a = 2, and b = 1, then:
grandma will tie 2 centimeters of the scarf. After that its length becomes equal to 2.
kitten will untie 1 centimeter of the scarf. After that its length becomes equal to 1.
grandma will tie 2 centimeters of the scarf. After that, its length becomes equal to 3
and the grandma gives the scarf to her grandchildren.
In the end, it took grandma two days to tie the scarf.
For the given n, a, and b, determine how many days it will take grandma to tie a scarf that is
at least n centimeters long.
Input
The first (and the only) line contains three positive integers n, a and b (1 ≤ n ≤ 100,
1 ≤ a < b ≤ 100) — the minimum required length of the scarf, the number of centimeters that
the grandma adds every day and the number of centimeters that the kitten reduces every
night.
Output
Output one number — how many days it will take grandma to tie a scarf that is at least n
centimeters long.
Examples
Input
3 2 1
Output
2
Input
1 2 1
Output
1
Input
100 99 98
Output
2
#Question 2
#A
Write a c++ program that implement the combination mathematical function c(n,k) using the
following equivalent definition:
Use recursive function in your code, the program should accept the value of n and k and display the
result.
#B
Given an input of an array of digits, return the array with each digit incremented by its
position in the array: the first digit will be incremented by 1, the second digit by 2, etc. Make
sure to start counting your positions from 1 (and not 0).
Your result can only contain single digit numbers, so if adding a digit with it's position gives
you a multiple-digit number, only the last digit of the number should be returned.
Notes:
#Question 3
Write a program that allows a kebele administrator to manage the resident in his district.
Your program should allow the administrator to register resident data like, resident family name,
street number or name, house number, number of family, name, age, birthdate, gender, marital
status, workplace, of each family member. Than the administrator should see the number of
residents, number of female residents, number of male residents, and other basic data
You could add other features too. Each new feature you might add has additional bonus.
#Question 2
14 ESTIBEL YIDEG AWUDIE
15 EYERUSALEM SIYUM TEGEGN
16 EYUEL GASHAYE KERIE
17 FIRAOL TOLESSA KANKURE
18 GIZACHEW TSEGA ALAMREW
19 HABIB MUHAMMED YESUF
20 KIDUS TADESSE BESHERGA
21 MAEREGU MUSTAR SULEMAN
22 MAHLET ADUGNA ZEMENU
23 MELAKU ZEGEYE ENDALEW
24 MELAT TEWACHEW ZEMEN
25 MERON MENGISTU BERTA
26 NATNAEL ADAMU ADANE
#Question 3
27 NATNAEL BERHANU MULUNEH
28 NUEMAN BESHIR HIYAR
29 NURAHMED ABAY MULTEZEM
30 NURAHMED JIBRIL IBRAHIM
31 NURU AHMED ALI
32 NURU AHMED ENDRIS
33 SALHE SEID ADEM
34 SAMUEL CHERU HUNIE
35 TSEGA TIGNEH YIFRU
36 WONDWOSSEN ABYE SISAY
37 YARED ABEBE DEMISSIE
38 YARED BELAY DAMTEW
39 YEABTSEGA GASHAW TILAHUN
40 ZUFAN HABTAMU BEKELE
Note: it’s forbidden to change the question number you are assigned on for any reason.