Problem B 完美的数字
Accept: 100 Submit: 515
Time Limit: 1000 mSec Memory Limit : 32768 KB
Problem Description
Bob是个很喜欢数字的孩子,现在他正在研究一个与数字相关的题目,我们知道一个数字的完美度是 把这个数字分解成三个整数相乘A*A*B(0
#include <iostream>
#define LL long long
using namespace std;
int main()
{
LL a,b;
while(cin>>a>>b)
{
LL sum = 0;
LL ans = 0;
LL s;
a--;
for( LL i = 1;i<=a;i++)
{
s = a / (i * i);
if(s >= i)
ans += s - i + 1;
else
break;
}
for(LL i = 1; i <= b; i++)
{
s = b / (i * i);
if(s >= i)
sum += s - i + 1;
else
break;
}
cout<<sum - ans<<endl;
}
return 0;
}