Pagini recente » Borderou de evaluare (job #1237439) | Cod sursa (job #3122190) | Cod sursa (job #3003050)
/******************************************************************************
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;
const int nmax=1000005;
int cnt[nmax];
int main()
{
int n,m;
ifstream fin("mins.in");
ofstream fout("mins.out");
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;
}