diff --git a/src/week5/BOJ3273/BOJ3273_V1.cpp b/src/week5/BOJ3273/BOJ3273_V1.cpp new file mode 100644 index 0000000..8d09b24 --- /dev/null +++ b/src/week5/BOJ3273/BOJ3273_V1.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; +int main() { + + int n; + cin >> n; + int arr[100000]; + + for (int i=0; i> arr[i]; + + sort(arr, arr+n); + int target; + cin >> target; + int st=0, ed=n-1, ret=0; + while(st < ed) { + if (arr[st] + arr[ed] < target) { + st++; + } else if (arr[st] + arr[ed] > target) { + ed--; + } else { + ret++; + st++; + ed--; + } + } + + cout << ret; + + return 0; +} \ No newline at end of file