-
Notifications
You must be signed in to change notification settings - Fork 4
/
A_Insomnia_cure.cpp
68 lines (61 loc) · 1.47 KB
/
A_Insomnia_cure.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<cstring>
#include<string>
#include <utility>
#define int int64_t
//typedef vector<int> vi;
//typedef vector<string> vs;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define rep(i, j) FOR(i, 0, j, 1)
#define rrep(i, j) RFOR(i, j, 0, 1)
#define MP make_pair
#define INF (int)1e18
#define EPS 1e-18
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
using namespace std;
void solve(){
int a,b,c,d;
cin>>a>>b>>c>>d;
int z;cin>>z;
int k=0;
vector<bool>v(z+1,false);
for(int i=1;i<=z;i++){
if(v[i])continue;
if(i%a==0){v[i]=true;k++;}
}
for(int i=1;i<=z;i++){
if(v[i])continue;
if(i%b==0){v[i]=true;k++;}
}
for(int i=1;i<=z;i++){
if(v[i])continue;
if(i%c==0){v[i]=true;k++;}
}
for(int i=1;i<=z;i++){
if(v[i])continue;
if(i%d==0){v[i]=true;k++;}
}
cout<<k;
}
signed main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
//#ifndef ONLINE_JUDGE
//FOR GETTING INPUT FROM input.txt
//freopen("input.txt", "r", stdin);
//FOR GETTING INPUT FROM input.txt
//freopen("output.txt", "w", stdout);
// #endif
int t=1;
//cin>>t;
while(t--){
solve();
cout<<endl;
}
}