#include <stdio.h>
#include <string.h>
int a[20000];
int size = 0;
int getNum(int x)
{
int i;
int sum = 0;
for (i = 1;i < x;i++)
{
if (x%i == 0)
sum += i;
}
return sum;
}
bool find(int x)
{
for (int i = 0;i < size;i++)
{
if (a[i] == x) return true;
}return false;
}
int main()
{
int m, n;
while (scanf("%d %d", &m, &n) != EOF)
{
int i,j,flag=0;
for (i = m;i <= n;i++)
{
if (find(i)) continue;
int x = getNum(i);
if (x >= m&&x <= n&&x!=i)
{
if (getNum(x) == i)
{
flag = 1;
a[size++] = i;
a[size++] = x;
printf("%d %d\n", i, x);
}
}
}
if (flag == 0) printf("NONE\n");
}
return 0;
}
孪生数(因数之和)
最新推荐文章于 2023-02-27 19:55:52 发布