답안 #86375

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86375 2018-11-26T08:22:57 Z dimash241 Savrsen (COCI17_savrsen) C++17
120 / 120
1717 ms 39780 KB
#include <iostream>

using namespace std;

int f[10000001];
int a, b;

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> a >> b;
	for (int i = 1; i <= b / 2; ++i) {
		int j = i + i;
		while (j <= b) {
			f[j] += i;
			j += i;
		}
	}

	long long ans = 0;
	for (int i = a; i <= b; ++i)
		ans += abs(f[i] - i);

	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 6 ms 792 KB Output is correct
4 Correct 1446 ms 39704 KB Output is correct
5 Correct 1502 ms 39780 KB Output is correct
6 Correct 1717 ms 39780 KB Output is correct
7 Correct 1286 ms 39780 KB Output is correct
8 Correct 146 ms 39780 KB Output is correct