Cod sursa(job #2846046)

Utilizator vladutzu_finutzuVlad Cacenschi vladutzu_finutzu Data 8 februarie 2022 18:09:43
Problema Mins Scor 50
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <fstream>
using namespace std;
ifstream cin("mins.in");
ofstream cout("mins.out");
int c, d;
int cnt[1000005];
int main() {
    cin>>c>>d;
    long long nr_p = 0;
    for(int i=2; i<min(c, d); i++)
    {
        nr_p -= (cnt[i] - 1) * ((c-1)/i) * ((d-1)/i);
        
        for(int j=i*2; j<min(c, d); j+=i)
            cnt[j] -= (cnt[i] - 1);
    }
    
    cout<<(long long)((c-1) * (d-1) - nr_p);
    return 0;
}