Skip to content

Commit ada7c8e

Browse files
authored
Create Question_Tcs_CodeVita_PhilalandCoin.txt
1 parent 649b84b commit ada7c8e

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Problem : Philaland Coin
2+
Problem Description The problem solvers have found a new Island for coding and named it as Philaland.
3+
4+
These smart people were given a task to make purchase of items at the Island easier by distributing various coins with different value.
5+
6+
Manish has come up with a solution that if we make coins category starting from $1 till the maximum price of item present on Island, then we can purchase any item easily. He added following example to prove his point.
7+
8+
Lets suppose the maximum price of an item is 5$ then we can make coins of {$1, $2, $3, $4, $5} to purchase any item ranging from $1 till $5.
9+
10+
Now Manisha, being a keen observer suggested that we could actually minimize the number of coins required and gave following distribution {$1, $2, $3}. According to him any item can be purchased one time ranging from $1 to $5. Everyone was impressed with both of them.
11+
12+
Your task is to help Manisha come up with minimum number of denominations for any arbitrary max price in Philaland.
13+
14+
Constraints 1<=T<=100
15+
16+
1<=N<=5000
17+
18+
Input Format First line contains an integer T denoting the number of test cases.
19+
20+
Next T lines contains an integer N denoting the maximum price of the item present on Philaland.
21+
22+
Output For each test case print a single line denoting the minimum number of denominations of coins required.
23+
24+
Test Case
25+
26+
Explanation Example 1
27+
28+
Input
29+
30+
2
31+
32+
10
33+
34+
5
35+
36+
Output
37+

0 commit comments

Comments
 (0)