## Problem A: Deficient, Perfect, and Abundant

Write a program that repeatedly reads a positive integer, determines if the integer is deficient, perfect, or abundant, and outputs the number along with its classification.

A positive integer, n, is said to be perfect if the sum of its proper divisors equals the number itself. (Proper divisors include 1 but not the number itself.) If this sum is less that n, the number is deficient, and if the sum is greater than n, the number is abundant.

The input starts with the number of integers that follow. For each of the following integers, your program should output the classification, as given below. You may assume that the input integers are greater than 1 and less than 32500.

```3
4
6
12```

### Sample Output

```4 is a deficient number.
6 is a perfect number.
12 is an abundant number.
```

Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M

Problem Types: [Show]

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

<
1
2
>

• (0/0)
Though I check the comments that share the same error about the number 28, I cannot understand my potential logic error on my code.Can somebody help me out?

• (0/0)

• (0/0)
Can anyone look over my code and tell me what's the problem? Thank you

• (0/0)
i suggest u put sum = 0 instead of sum = 1 each time u did that, and check for any grammar error in both the code and output

• (0/0)
Hi I fixed all the grammar error and now I got 5/5! Thank you so much!

• (0/0)
no problemo

• (1/1)
Can someone please check my code and tell me whats is wrong with it?
In details, it is showing my output for 28 is a perfect number but 28 is a perfect number, right? Thanks.

• (3/0)
In the Guidelines for submitting, we explicitly recommend against storing all outputs for the end.

Your code has a simple logic error. You should test your code on multiple inputs to make sure they're correct.

Do note that you won't be able to see all of your output, so your code is being tested on more than just the number 28.

• (1/0)
Thanks @jargon. Without storing inputs and outputs life is simple :).
Also I fixed my bug from earlier code.

• (1/0)
Hi, I;m getting the same problem as JamesBond, but I don't understand the solution jargon has given. Or perhaps i have a different error in my code? Could someone please help me.

• (1/1)
yep, you need to reset your sum, i tried your code with reseted sum and it works:) :p, there's your problem

• (1/1)
Thanks for your help @magicalsoup! The reset did work.

• (1/0)

So I need help with this, I think I know the problem but I don't know how to implement it.

• (1/0)
Sorry but I really don't get the meaning of "The input starts with the number of integers that follow", the format of input confuses me. Is it a continuous series of input numbers, or separated?

• (1/0)
Personally I feel the sample should make this clear, but let me reword it for you.

The first line of the input will contain a number T, the number of test cases.

Each of the following T lines will contain a positive integer n, 1 < n < 32500.

For each integer n, determine whether it is deficient, perfect, or abundant.

• (1/0)
Oh thx! I didn't expect to be replied so fast :D Now I get it

• (1/0)
I have tried running the program on my own multiple times, and the compiler never complained. Can I please be told why the judge doesn't accept it?
I apologize if it's something that had already been outlined in help.

• (1/0)
You have misinterpreted the input format. Your output does not currently match the sample case exactly.

Here are the first two lines of your exception. The last line would help you more, but you should be able to figure it out with this.
``Exception in thread "main" java.util.NoSuchElementException 	at java.util.Scanner.throwFor(Scanner.java:907)``

• (1/0)
I'm fairly certain my algorithm is correct but the judge keeps on failing me on the 30000 test case (i already did this in pascal with pretty much the same algorithm). At first I thought it was the range so i put it up to long int, but it still did not work, I even added one to it and it still got wrong (it was perfect number, added one and it was still perfect number).

Is this a known bug or did i get my algorithim wrong?

• (0/0)
Does your code work on the 30000 test case on your own computer? ;)

• (0/0)
Well, I just submitted this one... And the thing is that it is saying my answer for one of them is wrong. But I believe that is wrong. Could someone maybe check it? Thank you!

• (4/0)
Carefully compare your output with the sample testcase. It has to be the exact same.

• (0/0)
I still cannot figure it out. What I am outputting seems like the exact same as how it says it has to be on the question. But I guess I will take a look at it a bit later since I can't find it now. Thank you!

• (2/0)
*hint* grammar rules >:P

• (1/0)
Wow. LOL, thanks, I got it now :P

• (0/1)
i want to know aht i am getting wrong

• (1/1)
Read the sample output very carefully.

• (4/2)
it said less than 32500 so i thought integers were allowed....

• (2/1)
The number is less than 32500, but the sum of its divisors might not be. (The case you failed was 30000, for example)