#include <iostream>
#include <cstdio>
#include <cmath>

#include <string>
#include <vector>
#include<numeric>

using namespace std;

int main()
{
vector<int> inputNums;
vector<int> results;
while (true)
{
int num;
scanf_s("%d", &num);
if (num == 0)
{
break;
}

inputNums.push_back(num);

}

for (int i = 0; i < inputNums.size(); i++)
{
int num = inputNums[i];

vector<int> divisors;
for (int j = 1; j < (num / 2 + 1); j++)
{
if (num % j == 0)
{
divisors.push_back(j);
}
}

int sum = std::accumulate(divisors.begin(), divisors.end(), 0);

int result;
if (num > sum)
{
result = 1;
}
else if (num < sum)
{
result = -1;
}
else
{
result = 0;
}

results.push_back(result);

}

printf("PERFECTION OUTPUT\n");
for (int i = 0; i < results.size(); i++)
{
int result = results[i];
if (result>0)
{
printf("%5d DEFICIENT\n",inputNums[i]);
}
else if (result == 0)
{
printf("%5d PERFECT\n", inputNums[i]);
}
else
{
printf("%5d ABUNDANT\n", inputNums[i]);
}
}
printf("END of OUTPUT\n");

return 0;
}

POJ1528问题解答的更多相关文章

  1. MySQL同步常见问题解答(自己的小心得)

    前几天刚刚注册了博客园,我想写一些技巧性的教程,今天给大家分享一个MySQL同步常见问题解答. Q:如果主服务器正在运行并且不想停止主服务器,怎样配置一个从服务器? A:有多种方法.如果你在某时间点做 ...

  2. Delphi XE5 常见问题解答

    Delphi XE5 常见问题解答 有关于新即时试用的问题吗?请看看 RAD Studio 即时试用常见问答. 常见问题 什么是 Delphi? Embarcadero? Delphi? XE5 是易 ...

  3. SSL/TLS 高强度加密: 常见问题解答

    关于这个模块 mod_ssl 简史 mod_ssl会受到Wassenaar Arrangement(瓦森纳协议)的影响吗? mod_ssl 简史 mod_ssl v1 最早在1998年4月由Ralf ...

  4. Android Studio 中 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileDebugAidl'.的问题解答

    Android Studio 中 FAILURE: Build failed with an exception. * What went wrong: Execution failed for ta ...

  5. Hadoop科普文——常见的45个问题解答(CSDN)

    Hadoop科普文——常见的45个问题解答 1.Hadoop集群可以运行的3个模式? 单机(本地)模式 伪分布式模式 全分布式模式 2.  单机(本地)模式中的注意点? 在单机模式(standalon ...

  6. [!!!!!]Inno Setup教程-常见问题解答

    [转]Inno Setup教程-常见问题解答 功能 * 翻译 Inno Setup 文字  * 它支持 MBCS (多字节字符集) 吗?  * 将来会支持 Windows Installer 吗?   ...

  7. PHP常用函数和常见疑难问题解答

    PHP常用库函数介绍 一.PHP字符串操作常用函数 1.确定字符串长度  int strlen(string str) 2.比较两个字符串 a. strcmp函数对两个字符串进行二进制安全的比较,并区 ...

  8. 英特尔® 实感™ SDK 前置摄像头 (F200) 常见问题解答

    原文地址 https://software.intel.com/zh-cn/articles/intel-realsense-sdk-faq-for-front-facing-camera-f200? ...

  9. 我个人有关 Azure 网络 SLA、带宽、延迟、性能、SLB、DNS、DMZ、VNET、IPv6 等的 Azure 常见问题解答

    Igor Pagliai(微软)   2014 年 9月 28日上午 5:57  年 11 月 3 年欧洲 TechEd 大会新宣布的内容). 重要提示:这篇文章中我提供的信息具有时间敏感性,因为这些 ...

随机推荐

  1. Qt connect parent widget 连接父控件的信号槽

    Qt中的信号槽系统是不同类中间传递数据的神器,如果连接父子空间之间的信号槽很重要,在父类中实例化子类的时候一定要注意将父类连上,不然信号槽无法使用,比如若子类是个对话框Dialog类,一定不要忘了加t ...

  2. Phaser.Game这个函数都有哪些参数

    Phaser是一个简单易用且功能强大的html5游戏框架,利用它可以很轻松的开发出一个html5游戏.在这篇文章中我就教大家如何用Phaser来制作一个前段时间很火爆的游戏:Flappy Bird,希 ...

  3. IOS第六天(3:scrollView 图片轮播器)

    IOS第六天(3:scrollView 图片轮播器) #import "HMViewController.h" #define kImageCount 5 @interface H ...

  4. Leetcode | Work Break I & II

    Work Break I Given a string s and a dictionary of words dict, determine if s can be segmented into a ...

  5. 如何设置NBU的Backup, Archive and Restore

    第一行表示Master Server 第二行猜测表示当前主机 第三行不清楚   总结: 1. 这里压根就没有Media Server的事, Media Server对整个备份系统来说是透明的. 2. ...

  6. Sqlmap注入技巧集锦

    当我们注射的时候,判断注入 http://site/script?id=10 http://site/script?id=11-1 # 相当于 id=10 http://site/script?id= ...

  7. CSS权威指南 - 基本视觉格式化 1

    定位 定位的想法很简单元素框相对于正常位置出现在哪里. 定位:static,相对, 绝对, fixed, 继承 static就是默认的位置 相对就是相对于默认位置的偏移.原来的static定位位置依然 ...

  8. Oracle 语句常见错误

    Merge into的注意点之ORA-30926:无法在源表中获得一组稳定的行? merge into 的内部处理是将table_source 的每一条记录和table_target的每一条记录对比匹 ...

  9. Environment Variables

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms682653(v=vs.85).aspx Every process has an ...

  10. Flink - Generating Timestamps / Watermarks

    https://ci.apache.org/projects/flink/flink-docs-release-1.0/apis/streaming/event_timestamps_watermar ...