#P15930. [TOPC 2021] Aliquot Sum

    ID: 29387 远端评测题 8000ms 512MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>2021数论素数判断,质数,筛法ICPC台湾

[TOPC 2021] Aliquot Sum

题目描述

A divisor of a positive integer nn is an integer dd where m=ndm = \frac{n}{d} is an integer. In this problem, we define the aliquot sum s(n)s(n) of a positive integer nn as the sum of all divisors of nn other than nn itself. For examples, s(12)=1+2+3+4+6=16s(12) = 1 + 2 + 3 + 4 + 6 = 16, s(21)=1+3+7=11s(21) = 1 + 3 + 7 = 11, and s(28)=1+2+4+7+14=28s(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 xx is an abundant number if s(x)>xs(x) > x.
  2. A positive intewer yy is a deficient number if s(y)<ys(y) < y.
  3. A positive integer zz is a perfect number if s(z)=zs(z) = z.

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

输入格式

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

输出格式

Output TT lines. If nin_i is an abundant number, then print abundant on the ii-th line. If nin_i is a deficient number, then print deficient on the ii-th line. If nin_i is a perfect number, then print perfect on the ii-th line.

3
12 21 28
abundant
deficient
perfect

提示

  • 1T1061 \leq T \leq 10^6
  • 1ni1061 \leq n_i \leq 10^6 for i{1,2,,T}i \in \{1, 2, \dots, T\}.