Pagini recente » Cod sursa (job #3294117) | Cod sursa (job #456925) | Cod sursa (job #2537465) | Cod sursa (job #3260851) | Cod sursa (job #3003044)
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
ifstream fin("mins.in");
ofstream fout("mins.out");
int n,m;
const int nmax=1000005;
int cnt[nmax];
int main()
{
fin>>n>>m;
n--; m--;
long long nr=0;
for (int i=2; i<=min(n,m); ++i)
{
int x=cnt[i]-1;
nr-=1LL*x*n/i*m/i;
for (int j=i; j<=min(n,m); j+=i)
{
cnt[j]-=x;
}
}
fout<<1LL*n*m-nr;
return 0;
}