DCP-135: Abundant Number Back to All Problems

Easy Math > Basic Math


A number is 'abundant' if the sum of its proper divisors exceed the number. For example: 12 is an abundant number because sum of its proper divisors 1, 2, 3, 4 and 6 is 16 which is greater than 12. Abundance of 12 is 4 because 16-12=4. You will be given set(s) of distinct numbers and your task is to find the most abundant number and its abundance in each set. If two or more numbers have same abundance print the smallest of them. If no number is abundant then print -1. Input: ------ T (1<=T<=20), denoting the number of test cases. Each case contains an integer N (1 ≤ N ≤ 1000) denoting the size of the set. The next line will contain N integers separated by spaces, denoting the elements of the set. No integer will be less than 1 or greater than 10^5. Output: ------- For each test case having at least one abundant number the output should be in new line having two spaced numbers denoting the most abundant number and its abundance. If two or more numbers have same abundance print the smallest of them and its abundance. If there is no abundant number the output should be -1. Sample Input ------------ 1 2 12 6 Sample Output ------------- 12 4


Problem Setter:

Tanvir Zawad

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 6.00
C++ 6.00
C++14 6.00
C# 9.00
Go 9.00
Java 9.00
JavaScript 9.00
Objective-C 9.00
Perl 9.00
PHP 9.00
Python 9.00
Python3 9.00
Ruby 9.00
VB.Net 9.00

Problem Stats

187/532

Solve/Submission

Ranking

# User Language Timing
01 emrul Cpp14 0.00s
02 ash12 Cpp14 0.00s
03 jualahmed Cpp14 0.00s
04 afzalul Cpp14 0.00s
05 SakibAlamin Cpp 0.00s
06 anik_JU Cpp14 0.00s
07 feodorv C 0.00s
08 Mr_KAJOL Cpp 0.00s
09 shishir09 Cpp14 0.00s
10 tariqiitju Cpp 0.00s
11 souravahmed C 0.00s
12 mamun02inf Cpp 0.01s
13 akazad_cse13_ruet Cpp 0.01s
14 pulak_ict_mbstu Cpp14 0.01s
15 Morass Cpp14 0.01s
16 joymollick Cpp14 0.01s
17 JubayerSohel Cpp14 0.01s
18 ronok_cse Cpp14 0.01s
19 seyedssz Cpp14 0.01s
20 Ashish972 Cpp14 0.01s
21 Nazmul_WUB Cpp14 0.01s
22 Dinar Cpp14 0.01s
23 nafischonchol Cpp 0.01s
24 Taj025 CSharp 0.03s
25 prateepm Cpp14 0.03s
26 RandyWaterhouse Python3 0.04s
27 GarbageValue1 Cpp14 0.07s
28 Farwa Cpp14 0.07s
29 shahincsejnu Cpp14 0.07s
30 milak_yn Cpp14 0.08s
31 maz_leo Cpp14 0.08s
32 liar Cpp14 0.08s
33 ishtupeed Cpp14 0.08s
34 Md_Abid Cpp14 0.08s
35 nabil_053 Cpp14 0.09s
36 prodipdatta7 Cpp14 0.10s
37 MsNahid Cpp14 0.19s
38 Ahnat Cpp14 0.20s
39 gamerrishad Cpp14 0.23s
40 ashiq2446 Cpp14 0.23s
41 mahbub07 Cpp14 0.25s
42 Saimum_140128 Cpp14 0.26s
43 Rupasree Cpp14 0.27s
44 cse_nazmul Cpp14 0.29s
45 ddxofy Cpp14 0.30s
46 RakibR3 Cpp14 0.30s
47 talha629 Cpp14 0.32s
48 Zeronfinity Cpp14 0.32s
49 Mohtasim Cpp14 0.33s
50 Ansarul_14 Cpp14 0.33s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support