TopcoderArchiveVisit Topcoder
SRM22 May 2002
SRM 91

Perfect

Problem statement, definition, constraints, and public examples.

Problem Statement

PROBLEM STATEMENT

A number k is a divisor of N if k is a positive integer and there exists a
positive integer m such that k*m = N. A number N is called PERFECT if the sum
of all its divisors except itself is equal to N. For example, 6 = 1+2+3 is
perfect. A number N is called DEFICIENT if the sum of all its divisors except
itself is less than N. For example, 4 is deficient (1+2 < 4). A number N is
called ABUNDANT if the sum of all its divisors except itself is greater than N.
For example, 12 is abundant (1+2+3+4+6 > 12).

Your task is, given an int, determine if it is perfect, abundant or deficient
and return "PERFECT", "ABUNDANT" or "DEFICIENT" correspondingly.

DEFINITION
Class: Perfect
Method: perfectness
Parameters: int
Returns: String
Method signature (be sure your method is public):  String perfectness(int num);
 
TopCoder will ensure the validity of the inputs. Inputs are valid if all of the
following criteria are met: 
- num is between 2 and 50000 inclusive
 
EXAMPLES
1. num = 2, return "DEFICIENT"

2. num = 220, sum of divisors is (1+2+4+5+10+11+20+22+44+55+110=284), return
"ABUNDANT"

3. num = 28, sum of divisors is (1+2+4+7+14=28), return "PERFECT"

4. num = 17, sum of divisors is 1, return "DEFICIENT"

Definition

Class:
Perfect
Method:
perfectness
Parameters:
int
Returns:
String
Method signature:
String perfectness(int param0)
(be sure your method is public)

Constraints

    Examples

      No public sample cases were explicitly marked for this problem in the original data.

      Back to all problems