-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeforces_InsomniaCure.cpp
More file actions
67 lines (42 loc) · 1.27 KB
/
Codeforces_InsomniaCure.cpp
File metadata and controls
67 lines (42 loc) · 1.27 KB
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
#include <bits/stdc++.h>
using namespace std;
vector < unsigned long long > listOfdragons;
void insertDragons(int xthDragon, unsigned long long totDragons) {
unsigned long long temp, i = 1;
while(1) {
temp = xthDragon * i;
if(temp > totDragons) {
break;
}
else {
listOfdragons.push_back(temp);
}
i++;
}
}
int main() {
int kthDragon, lthDragon, mthDragon, nthDragon;
unsigned long long totDragon;
cin >> kthDragon >> lthDragon >> mthDragon >> nthDragon >> totDragon;
if(kthDragon == 1 || lthDragon == 1 || mthDragon == 1 || nthDragon == 1) {
cout << totDragon << endl;
}
else {
insertDragons(kthDragon, totDragon);
insertDragons(lthDragon, totDragon);
insertDragons(mthDragon, totDragon);
insertDragons(nthDragon, totDragon);
sort(listOfdragons.begin(), listOfdragons.end());
unsigned long long harmDragons = 0;
for(unsigned long long i = 0; i < listOfdragons.size(); i++) {
if(listOfdragons[i] == listOfdragons[i - 1]) {
continue;
}
else {
harmDragons++;
}
}
cout << harmDragons << endl;
}
return 0;
}