답안 #75826

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
75826 2018-09-11T08:30:33 Z charlies_moo Savrsen (COCI17_savrsen) C++
30 / 120
3000 ms 612 KB
#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;
}
# 결과 실행 시간 메모리 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