-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11414.cpp
More file actions
36 lines (34 loc) · 588 Bytes
/
11414.cpp
File metadata and controls
36 lines (34 loc) · 588 Bytes
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
#include <iostream>
#include <set>
using namespace std;
typedef long long ll;
void solve()
{
ll a,b;cin>>a>>b;
set<ll> as;
for (ll i = 2; i <= a; ++i)
{
if(a%i==0)
{
as.insert(i);
while(a%i==0)a/=i;
}
}
for (ll i = 2; i <= b; ++i)
{
if(b%i==0)
{
as.insert(i);
while(b%i==0)b/=i;
}
}
ll r = 1;
for (ll c : as) r*=c;
cout << r;
}
int main()
{
cin.tie(0)->sync_with_stdio(false);
solve();
return 0;
}