#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define sf scanf
#define pf printf
typedef long long ll;
int main()
{
int k, l, m, n, d;
cin >> k >> l >> m >> n >> d;
int count = 0;
for(int i=1; i<=d; i++)
{
if(i%k==0 || i%l ==0 || i%m ==0 || i%n ==0)
{
count++;
}
}
cout << count << endl;
}
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define sf scanf
#define pf printf
typedef long long ll;
int main()
{
int k, l, m, n, d;
cin >> k >> l >> m >> n >> d;
int count = 0;
for(int i=1; i<=d; i++)
{
if(i%k==0 || i%l ==0 || i%m ==0 || i%n ==0)
{
count++;
}
}
cout << count << endl;
}
Hello Buddy
ReplyDeleteWhat must we do if d is very very large?
ReplyDelete