-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy path1209 A. Paint the Numbers.cpp
More file actions
48 lines (46 loc) · 988 Bytes
/
Copy path1209 A. Paint the Numbers.cpp
File metadata and controls
48 lines (46 loc) · 988 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
37
38
39
40
41
42
43
44
45
46
47
48
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
int main()
{
int n, a, one = 0;
cin>>n;
vector<int>v;
for(int i=0; i<n; i++){
cin>>a;
v.push_back(a);
if(a == 1)one++;
}
sort(v.begin(),v.end());
if(n == 1){
cout<<1<<endl;
return 0;
}
int ans = 0;
for(int i=0; i<v.size(); i++){
for(int j=i+1; j<v.size(); j++){
if(v[j] % v[i] == 0){
v.erase(v.begin()+j);
}
}
}
for(int i=0; i<v.size(); i++){
for(int j=i+1; j<v.size(); j++){
if(v[j] % v[i] == 0){
v.erase(v.begin()+j);
}
}
}
if(one > 0){
cout<<1<<endl;
}
else{
cout<<v.size()<<endl;
}
// for(int i=0; i<v.size(); i++){
// cout<<v[i]<<" ";
// }
cout<<endl;
}