Pagini recente » Cod sursa (job #2165791) | Cod sursa (job #1930731) | Cod sursa (job #1740971) | Cod sursa (job #616748) | Cod sursa (job #2848830)
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define dbg(i) (cout<<#i<<" = "<<(i)<<'\n')
using ll = long long;
const string fn = "mins";
ifstream fin(fn + ".in");
ofstream fout(fn + ".out");
int c, d;
int cnt[1000005];
ll sol, ans;
int main() {
ios_base::sync_with_stdio(false);
cin.tie();
fin.tie();
fin >> c >> d;
c--; d--;
if (d < c)
swap(c, d);
for(int k = 2; k <= c; ++k){
if(cnt[k]==1)
continue;
int balance = 1 - cnt[k];
sol += 1LL * balance * (c/k) * (d / k);
for(int mult = k + k; mult <= c; mult += k)
cnt[mult] = cnt[mult] + balance;
}
ans = 1LL * c * d;
ans = ans - sol;
fout << ans << '\n';
fin.close();
fout.close();
}