Problem1948--使用函数输出指定范围内的完数

1948: 使用函数输出指定范围内的完数

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 0
[Submit] [Status] [Web Board] [Creator:]

Description

本题要求实现一个计算整数因子和的简单函数,并利用其实现另一个函数,输出两正整数m和n(0 int factorsum( int number ); void PrintPN( int m, int n ); int main() { int i, m, n; scanf(

Input

整数number,区间整数m, n

Output

其中函数factorsum须返回int number的因子和;函数PrintPN要逐行输出给定范围[m, n]内每个完数的因子累加形式的分解式,每个完数占一行,格式为“完数 = 因子1 + 因子2 + ... + 因子k”,其中完数和因子均按递增顺序给出。如果给定区间内没有完数,则输出一行“No perfect number”。

Sample Input Copy

1 30

Sample Output Copy

1 is a perfect number
1 = 1
6 = 1 + 2 + 3
28 = 1 + 2 + 4 + 7 + 14

Source/Category

209