题解 | #完全数计算#
完全数计算
http://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84
#include <stdio.h> int number; int all = 0; int main(void) { while (scanf("%d", &number) != EOF) { int count = 0; for (int i = 1; i < number; i++) { int all = 0; for (int j = 1; j < i; j++) { if (i % j == 0)all += j; } if (all == i) { // printf("%d\n",all); count++; } } printf("%d", count); } }