- 亲和数
- 2017-02-07 16:07:23 @
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cstring>
#include <vector>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <iomanip>
using namespace std;
long long factor(long long a)
{
long long sum=0;
for (int i=1;i<a;i++)
{
if (a%i==0) sum=sum+i;
}
return (sum);
}
int main() {
//freopen("//xx.in","r",stdin);
//freopen("//xx.out","w",stdout);
long long a,b,count=0;
cin>>a>>b;
for (int i=a;i<=b;i++)
{
for (int j=i+1;j<=b;j++)
{
if (i==factor(j)&&j==factor(i))
{
count++;
}
}
}
cout<<count<<endl;
//fclose(stdin);
//fclose(stdout);
//while (1);
return 0;
}