当前位置:网站首页>HDU1323_ Perfection [water question]
HDU1323_ Perfection [water question]
2022-07-27 19:36:00 【51CTO】
Perfection
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1748 Accepted Submission(s): 1051
Problem Description
From the article Number Theory in the 1994 Microsoft Encarta: "If a, b, c are integers such that a = bc, a is called a multiple of b or of c, and b or c is called a divisor or factor of a. If c is not 1/-1, b is called a proper divisor of a. Even integers, which include 0, are multiples of 2, for example, -4, 0, 2, 10; an odd integer is an integer that is not even, for example, -5, 1, 3, 9. A perfect number is a positive integer that is equal to the sum of all its positive, proper divisors; for example, 6, which equals 1 + 2 + 3, and 28, which equals 1 + 2 + 4 + 7 + 14, are perfect numbers. A positive number that is not perfect is imperfect and is deficient or abundant according to whether the sum of its positive, proper divisors is smaller or larger than the number itself. Thus, 9, with proper divisors 1, 3, is deficient; 12, with proper divisors 1, 2, 3, 4, 6, is abundant."
Given a number, determine if it is perfect, abundant, or deficient.
Input
A list of N positive integers (none greater than 60,000), with 1 < N < 100. A 0 will mark the end of the list.
Output
The first line of output should read PERFECTION OUTPUT. The next N lines of output should list for each input integer whether it is perfect, deficient, or abundant, as shown in the example below. Format counts: the echoed integers should be right justified within the first 5 spaces of the output line, followed by two blank spaces, followed by the description of the integer. The final line of output should read END OF OUTPUT.
Sample Input
15 28 6 56 60000 22 496 0
Sample Output
PERFECTION OUTPUT
15 DEFICIENT
28 PERFECT
6 PERFECT
56 ABUNDANT
60000 ABUNDANT
22 DEFICIENT
496 PERFECT
END OF OUTPUT
Source
Mid-Atlantic USA 1996
The main idea of the topic : If the sum of divisors of a number is greater than it , Namely ABUNDANT, If equal to it , Namely
PERFECT, If the fruit is smaller than itself , Namely DEFICIENT.
Ideas : Judge according to the requirements and provisions of the topic 、 Output .
边栏推荐
- 一种比读写锁更快的锁,还不赶紧认识一下
- There is a problem with the time zone when the idea connects to the database. The server returns invalid timezone is red Need to set ‘serverTimezone‘ property.
- kettle JVM内存设置---效果不明显
- Summary of APP launch in vivo application market
- SQL Server top keyword usage
- Golang sets the domestic image, vscode configures the golang development environment, and vscode debugs the golang code
- Browser rendering principle analysis suggestions collection
- kettle入门级操作第一篇(读取excel、输出excel)
- 2022 preparation for autumn recruitment 10W word interview sketch PDF version, with operating system and computer network interview questions
- 原厂PW4203降压型1-3节锂电池充电芯片
猜你喜欢

How can I get started quickly when I change my career to soft testing and job hopping to a new company?

嵌入式C语言结构体

Web3.0热浪之下 门萨Mensa生态震撼来袭

C language: 12. GDB tool debugging C program

Rename file with command line

Golang sets the domestic image, vscode configures the golang development environment, and vscode debugs the golang code

What if idea successfully connects to the database without displaying the table

101. (cesium chapter) cesium particle system - snow

c语言:clion调试方法

Kettle switch / case control to realize classification processing
随机推荐
利用 Fastjson json (简单粗暴版)
Tab control of MFC advanced control (CTabCtrl)
几种无线协议简介
Automatic testing of Web UI: Selenium syntax explanation is the most complete in the history
kettle 分列、合并记录
SQL field type conversion
SQL Server top keyword usage
低代码实现探索(四十五)业务参数
SQL server top 关键字使用
Subscription and use of Alibaba cloud video on demand service
Definition of graph traversal and depth first search and breadth first search (2)
Cyclic multi-Variate Function for Self-Supervised Image Denoising by Disentangling Noise from Image
kettle8.2 安装及常见问题
让你的聊天气泡丰富多彩
Win10 tips (1) -- transfer desktop location
Browser rendering principle analysis suggestions collection
Under the heat wave of Web3.0, the ecological shock of Mensa struck
搭建阿里云+typora+Picgo图床错误分析
Mongodb learning notes (1) - install mongodb and its related configurations
The first entry-level operation of kettle (reading excel, outputting Excel)