We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5513fe4 commit 75c9064Copy full SHA for 75c9064
khj20006/202510/03 BOJ G2 시그마 함수.md
@@ -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