Cod sursa(job #2961468)
Utilizator | Ruxandra Vasilescu Ruxandra009 | Data | 6 ianuarie 2023 15:42:32 |
---|---|---|---|
Problema | Mins | Scor | 85 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("mins.in");
ofstream g("mins.out");
const int NrMax = 1000005;
int n, m, nr[NrMax], x;
long long cnt;
int main()
{
f >> n >> m;
n --; m --;
for(int i = 2; i <= min(n, m); i ++)
{
x = nr[i] - 1;
cnt -= 1LL * x * (n / i) * (m / i);
for(int j = i; j <= min(n, m); j += i)
nr[j] -= x;
}
g << 1LL * n * m - cnt;
return 0;
}