Skip to content

Commit 75c9064

Browse files
authored
[20251003] BOJ / G2 / 시그마 함수 / 권혁준
1 parent 5513fe4 commit 75c9064

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
```cpp
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
using ll = long long;
5+
6+
ll N;
7+
8+
unordered_set<ll> m;
9+
bitset<1000001> e;
10+
vector<ll> p = {2};
11+
12+
void bck(ll n) {
13+
for(ll i:p) {
14+
if((__int128)n*i > (__int128)N) break;
15+
if(m.count(n*i)) continue;
16+
m.insert(n*i);
17+
bck(n*i);
18+
}
19+
}
20+
21+
int main(){
22+
cin.tie(0)->sync_with_stdio(0);
23+
24+
for(int i=2;i*i<=1000000;i++) if(!e[i]) for(int j=i*i;j<=1000000;j+=i) e[j] = 1;
25+
for(ll i=3;i<=1000000;i++) if(!e[i]) p.push_back(i*i);
26+
27+
cin>>N;
28+
m.insert(1);
29+
bck(1);
30+
31+
cout<<N-m.size()<<'\n';
32+
33+
}
34+
```

0 commit comments

Comments
 (0)