Accenture CodingPart4
Accenture CodingPart4
Print the pattern: You have been given the number of rows: n=5
*****
****
***
**
*
Problem Statement: Print the pattern.
Given below is the cross pattern has the shape of the mathematical cross sign (X).
For n=5
* *
**
*
**
* *
Problem Statement:
Ann recently began using the metro to work. We are aware that a single ride on the metro costs one ruble. Ann also learned that she can purchase a unique ticket for the rides ( she can buy it
several times). The price is b rubles. Ann calculated that she would need to take the subway n times. Help Ann out by letting her know how much money she must have in order to buy n rides.
Input:
The four numbers n, m, a, b (1 <= n , m, a, b <= 1000) on a single line represent the number of rides Ann has scheduled, the number of rides covered by the m ride ticket, the cost of a one ride
ticket, and the cost of a m ride ticket.
Output: Print a single integer –the minimum sum in rubles that Ann will need to spend.
Input:
6212
Output:
6
Input:
5223
Output:
8
Problem Statement:
Return the fewest number of perfect square numbers that add up to n, given n integer n.
An integer that is the square of another integer, or the product of another integer and itself, is referred to as perfect square. For instance while 3 and 11 are not perfect
square, 1, 4, 9 and 16 are.
Input: n=12
Output: 3