#include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
int is_perfect(long long n)
{
int sum=0;
for(int i=1;i<=sqrt(n);i++)
{
if(n%i==0)
{
if(i<n)
sum+=i;
if((n/i)<n)
sum+=n/i;
}
}
sum-=n;
int sqn=sqrt(n);
if(sqn*sqn==n && sqn<n)
sum-=sqn;
return abs(sum);
}
int main()
{
int a,b,ans=0;
cin>>a>>b;
for(int i=a;i<=b;i++)
ans+=is_perfect(i);
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
488 KB |
Output is correct |
3 |
Incorrect |
306 ms |
488 KB |
Output isn't correct |
4 |
Incorrect |
47 ms |
612 KB |
Output isn't correct |
5 |
Execution timed out |
3040 ms |
612 KB |
Time limit exceeded |
6 |
Execution timed out |
3057 ms |
612 KB |
Time limit exceeded |
7 |
Execution timed out |
3052 ms |
612 KB |
Time limit exceeded |
8 |
Execution timed out |
3062 ms |
612 KB |
Time limit exceeded |