## 11 Nov Aurora Saturday 14:30 Python Practice 20.11.07.

**Repeat questions from last week:Question 1:**A spiral of numbers can start and end with any positive integers less than 100. Write a program which will accept two positive integers x and y as input, and output a list of numbers from x to y inclusive, shown in a spiral. You may assume that the end value is greater than or equal to the start value.

A spiral starts with the first number in the center. The next number appears immediately below the first number. The spiral continues with the numbers increasing in a counter-clockwise direction until the last number is printed.

Sample Input 1

10

27Sample Output 1

27 26

16 15 14 25

17 10 13 24

18 11 12 23

19 20 21 22

Sample Input 2

7

12Sample Output 2

12 11

7 10

8 9

**Question 2: (Please use faster solution to solve)**

Jack is depositing money! Every year, Jack puts ** N **coins into his bank account. At the end of each year, Jack’s investments will grow by

*percent,*

**P****rounded down**to the nearest coin. After

*years, he would like to have at least*

**Y***coins in his bank account so that he can buy some presents for a special someone. Since Jack is an efficient individual, he would like to know the minimum number of coins he has to put into his bank account every year so that he will have*

**T****coins by the end of**

*T***years. Can you help him find this value?**

*Y***Input Specification**

The first and only line will contain 3 space separated integers * P*,

**, and**

*Y***.**

*T***Output Specification**

The output should contain a single integer, the minimum number of coins N that Jack should put into his bank account per year.

Sample Input 150 3 200Sample Output 129Explanation for Sample Output 1Initially, Jack's bank account is empty. In the first year, Jack deposits 29 coins into the bank, which at the end of the year turns into 43 coins (rounding down). In the second year he again deposits 29 coins, reaching a total of 72 coins. At the end of the year, the interest boosts this up to 108 coins. In the third year, The balance is 137 coins after Jack's deposit, increasing to 205 coins after interest.

Sample Input 2100 2 300Sample Output 250Explanation for Sample Output 2Here is Jack's bank balance over the course of 2 years: Year 1: +50 50→100 Year 2: +50 150→300

Sample Input 380 2 4Sample Output 32Explanation for Sample Output 3Due to the interest being rounded down to the nearest coin, only depositing 1 coin per year would not be enough.

Sample Input 411 63524 9182748294Sample Output 41

Sorry, the comment form is closed at this time.