Different countries use different coin denominations. For example, Bangladesh uses 1, 2, and 5. A desirable property of coin denominations is to have each coin at least twice the amount of its previous coin in sorted order. For example, the Bangladesh coin denominations have this property, but the coin denominations {1, 5, 6} do not (6 is not at least twice 5).
The Problem:
Given the coin denominations, you are to determine if the set has the above property.
Input Format
The first input line contains a positive integer, n, indicating the number of denomination sets to check. The sets are on the following n input lines, one set per line. Each set starts with an integer d , which is a count of various coin amounts in the set; this is followed by d distinct positive integers (each less than 1,000) giving each coin amount (assume the coin amounts are given in increasing order).
Constraints
(1 ≤ d ≤ 10)
Output Format
At the beginning of each test case, output "Denominations: v" where v is the input values. Then, on the next output line, print a message indicating whether or not the set has the above property. Leave a blank line after the output for each test case. Follow the format illustrated in Sample Output.
Sample Input 0
2
4 1 5 10 25
3 1 5 6
Sample Output 0
Denominations: 1 5 10 25
Good coin denominations!
Denominations: 1 5 6
Bad coin denominations!
please c programming language
Answers
Answered by
0
Answer:
Galvanisation is a method of protecting steel and iron from rusting by coating them with a thin layer of zinc. The galvanised article is protected against rusting even if the zinc coating is brokenGalvanisation is a method of protecting steel and iron from rusting by coating them with a thin layer of zinc. The galvanised article is protected against rusting even if the zinc coating is broken
Similar questions
Computer Science,
1 month ago
Science,
1 month ago
Social Sciences,
1 month ago
Political Science,
3 months ago
India Languages,
9 months ago
India Languages,
9 months ago