Cod sursa(job #2845517)

Utilizator mariaionescu2006Ionescu Maria mariaionescu2006 Data 7 februarie 2022 22:24:36
Problema Mins Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("mins.in");
ofstream fout ("mins.out");
int c,d,k,cnt[1000005],nrp;
int main()
{
    fin >>c>>d;
    for (int k=2;k<=1000000;k++)
        {nrp-=(cnt[k]-1)*(c-1)/k*(d-1)/k;
         for (int m=2*k;m<=1000000;m=m+k)
             {cnt[m]-=(cnt[m]-1);}}
    fout <<(c-1)*(d-1)-nrp;
    return 0;
}