Cod sursa(job #2962368)

Utilizator RaduAntoneoAntonio Alexandru Radu RaduAntoneo Data 8 ianuarie 2023 14:22:21
Problema Fractii Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <bits/stdc++.h>
using namespace std;

ifstream f("fractii.in");
ofstream g("fractii.out");
#define cin f
#define cout g

vector<int> count_divisors;

int main() {
	int n;
	cin >> n;
	count_divisors.resize(n+1, n);

	for (int i = 2; i <= n; i++) {
		for (int j = i; j <= n; j += i)
			count_divisors[j] -= 1;
	}

	int ans = -n;
	for (int x : count_divisors) 
		ans += x;

	cout << ans-1;
	return 0;
}