आसान 0 हल किए गए 0% स्वीकृति

Classify a Number by Its Divisors

Classify a positive integer as perfect, abundant, or deficient.

Add the positive divisors of n that are strictly smaller than n. If their sum equals n, the number is perfect. If the sum is larger, it is abundant; if smaller, it is deficient. The number 1 has no proper positive divisors, so its divisor sum is 0.

Implement perfect_number(n).

Input

n: The positive integer to classify.

Output

Return perfect, abundant, or deficient as lowercase text.

सीमाएँ

1 ≤ n ≤ 1,000,000. Zero and negative values are excluded.

उदाहरण

उदाहरण 1
इनपुट:
n = 18

अपेक्षित आउटपुट:
expected = "abundant"
इनपुट:
long long n = 18;

अपेक्षित आउटपुट:
std::string expected = "abundant";
इनपुट:
long n = 18;

अपेक्षित आउटपुट:
string expected = "abundant";

व्याख्या

The proper divisors are 1, 2, 3, 6, and 9. Their sum is 21, greater than 18.

उदाहरण 2
इनपुट:
n = 28

अपेक्षित आउटपुट:
expected = "perfect"
इनपुट:
long long n = 28;

अपेक्षित आउटपुट:
std::string expected = "perfect";
इनपुट:
long n = 28;

अपेक्षित आउटपुट:
string expected = "perfect";

व्याख्या

The proper divisors sum to 1 + 2 + 4 + 7 + 14 = 28, exactly the number itself.

संदर्भ

यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।

दूसरों से सीखें

समुदाय समाधान

अभी तक कोई प्रकाशित समाधान नहीं। पहला साझा करने के लिए इस चुनौती को हल करें।