Preparing NOJ

Aliquot Sum

8000ms 1048576K

Description:

A divisor of a positive integer $$$n$$$ is an integer $$$d$$$ where $$$m=\frac{n}{d}$$$ is an integer. In this problem, we define the aliquot sum $$$s(n)$$$ of a positive integer $$$n$$$ as the sum of all divisors of $$$n$$$ other than $$$n$$$ itself. For examples, $$$s(12)=1+2+3+4+6=16$$$, $$$s(21)=1+3+7=11$$$, and $$$s(28)=1+2+4+7+14=28$$$.

With the aliquot sum, we can classify positive integers into three types: abundant numbers, deficient numbers, and perfect numbers. The rules are as follows.

  1. A positive integer $$$x$$$ is an abundant number if $$$s(x)>x$$$.
  2. A positive intewer $$$y$$$ is a deficient number if $$$s(y)<y$$$.
  3. A positive integer $$$z$$$ is a perfect number if $$$s(z)=z$$$.

You are given a list of positive integers. Please write a program to classify them.

Input:

The first line of the input contains one positive integer $$$T$$$ indicating the number of test cases. The second line of the input contains $$$T$$$ space-separated positive integers $$$n_1,\dots,n_T$$$.

  • $$$1\le T\le 10^6$$$
  • $$$1 \le n_i \le 10^6$$$ for $$$i \in \{1,2,\dots,T\}$$$.

Output:

Output $$$T$$$ lines. If $$$n_i$$$ is an abundant number, then print abundant on the $$$i$$$-th line. If $$$n_i$$$ is a deficient number, then print deficient on the $$$i$$$-th line. If $$$n_i$$$ is a perfect number, then print perfect on the $$$i$$$-th line.

Sample Input:

3
12 21 28

Sample Output:

abundant
deficient
perfect

Info

CodeForces Gym

Provider CodeForces Gym

Origin 2021 ICPC Asia Taiwan Online Programming Contest

Code GYM103373B

Tags

Submitted 1

Passed 0

AC Rate 0%

Date 10/31/2021 14:45:58

Related

Nothing Yet