Cod sursa(job #3226488)
Utilizator | Data | 21 aprilie 2024 15:57:59 | |
---|---|---|---|
Problema | Mins | Scor | 60 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include<iostream>
using namespace std;
constexpr int NMAX = 1e6 + 1;
long long ans[NMAX];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
freopen("mins.in","r",stdin);
freopen("mins.out","w",stdout);
int n,m; cin >> n >> m;
--n,--m; n = min(n,m);
for(int i = n; i ; i--)
{
ans[i] = 1LL * (n / i) * (m / i);
for(int j = i + i ; j <= n; j += i)
ans[i] -= ans[j];
}
cout << ans[1];
}