blob: d8eb85f267f3d1fdc98788c5805fd9e83fc32a7e (
plain) (
blame)
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
|
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;
class Obmo {
public:
int z, k, nsd;
set<int> obm;
Obmo () {
z = 0;
k = 0;
obm.clear();
}
void dodaj (int val) {
if (!obm.count()) {
nsd = val;
obm.insert(val);
return;
}
if (obm.count() == 1) {
nsd = gcd(val, nsd);
obm.insert(val);
return;
}
if (val % nsd == 0) {
obm.insert(val);
return;
}
for (auto itr = obm.begin(); itr != obm.end(); itr++) {
if *itr:q
}
}
void odvzemi (int val) {
if (obm.count() == 2) {
obm.erase(val);
nsd = gcd(*obm.begin())
}
}
int get (void) {
return nsd;
}
};
int main (void) {
cout << "hw" << endl;
}
|