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

Your feedback is our precious!

Or call +88 02 9853138 for support