Skip to content

Commit 6149971

Browse files
authored
Merge pull request #1197 from AlgorithmWithGod/khj20006
[20251022] BOJ / G3 / 좋은 수 / 권혁준
2 parents 54fd787 + ad2ab4c commit 6149971

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)