当前位置:网站首页>HDU1323_Perfection【水题】
HDU1323_Perfection【水题】
2022-07-27 16:41: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
题目大意:如果一个数的约数和大于它,就是ABUNDANT,如果等于它,就是
PERFECT,若果小于它本身,就是DEFICIENT。
思路:按题目要求和规定判断、输出。
边栏推荐
- X-shell remote connection virtual machine
- There is another example of repeater
- Electromagnetic field learning notes - vector analysis and field theory foundation
- Basic concepts of Nacos and single machine deployment
- Summary of "performance test" of special test
- JMeter interface automation - how to solve the content type conflict of request headers
- How to break the team with automated testing
- Dynamic proxy
- Latex use - subfigure vertical graphics
- 我想咨询下,我们的maxcompute spark程序需要访问redis,开发环境和生产环境redi
猜你喜欢

kettle8.2 安装及常见问题

The go zero singleton service uses generics to simplify the registration of handler routes

大冤种们,新进测试行业,如何正确选择意向企业?

web UI 自动化测试:Selenium 语法详解 史上最全

ES6学习笔记(1)——快速入门

搭建阿里云+typora+Picgo图床错误分析

How to break the team with automated testing

收下这份实操案例,还怕不会用Jmeter接口测试工具

C # interaction with MySQL database - MySQL configuration and addition, deletion, query and modification operations

一篇让你掌握线程和线程池,还解决了线程安全问题,确定不看看?
随机推荐
200 lines of code quick start document database monogodb
2022 preparation for autumn recruitment 10W word interview sketch PDF version, with operating system and computer network interview questions
一个经验
Unity learning notes (rigid body physics collider trigger)
kettle入门级操作第一篇(读取excel、输出excel)
IPFs obtains the public key and private key through the interface, and encrypts the storage. First bullet
New system installation mysql+sqlyog
Kettle separate and merge records
SQL server top 关键字使用
Subscription and use of Alibaba cloud video on demand service
HDU1573 X问题【一元线性同余方程组】
IDEA成功连接Database但不显示表怎么办
C语言案例:密码设置及登录> 明解getchar与scanf
asp.net 的经验
js常用utils封装
Selenium automated test interview questions family bucket
【云图说】 第250期 初识华为云微服务引擎CSE
opds sql 里面可以用set 定义局部变量吗
Kinect2 for unity3d - avatardemo learning
C language case: password setting and login > clear solution getchar and scanf