답안 #86353

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86353 2018-11-26T08:02:13 Z Asag Savrsen (COCI17_savrsen) C++14
120 / 120
2125 ms 78896 KB
#include <bits/stdc++.h>
using namespace std;
long long n,m,sum[10000000 + 5],ans;
int main()
{
	cin>>n>>m;
	for(int i = 2; i  <= 10000000;i ++)
	{
		for(int j = i + i; j <= 10000000 ;j +=i)
		{
			sum[j]+=i;
		}
	}sum[1] = 1;
	for(int i = n;i <= m ;i ++)
	{
		ans+=abs(i - (sum[i] + 1));
    }cout<<ans;
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 2047 ms 78628 KB Output is correct
2 Correct 1978 ms 78708 KB Output is correct
3 Correct 2031 ms 78728 KB Output is correct
4 Correct 2125 ms 78804 KB Output is correct
5 Correct 1968 ms 78848 KB Output is correct
6 Correct 1969 ms 78880 KB Output is correct
7 Correct 2007 ms 78896 KB Output is correct
8 Correct 1978 ms 78896 KB Output is correct