We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3adc618 commit ad2ab4cCopy full SHA for ad2ab4c
1 file changed
khj20006/202510/22 BOJ G3 좋은 수.md
@@ -0,0 +1,25 @@
1
+```cpp
2
+#include <bits/stdc++.h>
3
+using namespace std;
4
+
5
+int N, a[5000]{};
6
+bitset<400001> v;
7
8
+int main() {
9
+ cin.tie(0)->sync_with_stdio(0);
10
11
+ cin >> N;
12
+ int ans = 0;
13
+ for (int i = 0; i < N; i++) {
14
+ cin >> a[i];
15
+ int res = 0;
16
+ for (int j = 0; j < i; j++) {
17
+ if (v[a[i] - a[j] + 200000]) res = 1;
18
+ }
19
+ for (int j = 0; j <= i; j++) v[a[i] + a[j] + 200000] = 1;
20
+ ans += res;
21
22
+ cout << ans;
23
24
+}
25
+```
0 commit comments