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




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

Your feedback is our precious!

Or call +88 02 9853138 for support