A. Insomnia cure(171)

 avatar
jackoup
c_cpp
a year ago
426 B
9
Indexable
CodeForces
#include <iostream>
#include <set>


using namespace std;
void fio() {
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
}

int main() {
    fio();
    int k,l,m,n,d;
    cin>>k;cin>>l;cin>>m;cin>>n;cin>>d;
    set<int> s;
    auto it = s.begin();
    for( int i = 1;i<=d;i++) {
        if(i%k == 0|| i%l ==0 || i%m == 0 || i%n == 0)
            it = s.emplace_hint(it,i);
    }
    cout<<s.size();
}
Editor is loading...
Leave a Comment